Jump to content

alfreTS - copy formatted current timestamp to clipboard

Recommended Posts


This is a time stamp workflow for the Alfred Application.


Download the current package via dropbox.


Open the alfred window then type now. The results show the current timestamp in different formats. Select a timestamp format to copy the shown timestamp to the clipboard. Paste it into any editor you like.


You can define your own formats via the python strftime syntax. It is also possible to define your preferred locale setting to acquire the weekday and month names in your local language. In order to edit these settings you need to enter the settings into the script of the Script Filter inside the workflow. This can be done by editing the #commented lines. (In case you did not know how #comments work: lines with # in front will be ignored by the python interpreter and not be executed.)


Please visit the projects github repository.


If you are using this workflow and you happen to make a new format for timestamps please share it here. Thankyou!


<( ^_^)> hug me <(^.^ )>


PS: somehow I cannot add screenshots here. It says I am not allowed to link *.png files  (T_T)"  If you would like to see some screenshots please visit the github repository. The README.md contains two screenshots.


update: new version online =) alfreTS_v0.0.201402142154.alfredworkflow


Question to all users: Would you like to have an interface via the Alfred input window to edit your locale and your formats?

Edited by LittleEntity
Link to comment

Hi =)


I've tried to fix this issue for quite a while now. Right now I cannot find what breaks it. It's something with the Element Tree tostring( ) library function that breaks it. I assume the greek weekday letters contain non ascii symbols. Actually that should be addressed by the tostring( ) method.

I'm doing something wrong I guess... I'll try next week to fix it. Got an exam next Monday ^^"


thank you for your reply =D


PS: fixed some bugs on the way ^^ so it wasn't completely useless =)

Edited by LittleEntity
Link to comment

new version online! GREEK LOCALE is now supported! download it from the drop box ^^


Download the current package via dropbox.


I don't exactly know how I fixed it but it works with greek letters now. I really need to learn more about encodings and stuff ...

I will learn about encodings next week ^^


enjoy the update =)


@M1m1s: please write a greek format string to the forums so we can share it for everyone =D thank you. <(^.^)> *cheer!* <(^o^)>

Edited by LittleEntity
Link to comment

Great idea!


Small bug: the "German date representation" is a bit wrong.


("%A %d.%b.%Y um %H:%M Uhr", "German date representation")


produces Montag 17.Feb.2014 um 10:06 Uhr


It should read:


("%A %d. %b %Y um %H:%M Uhr", "German date representation")


which produces Monday 17. Feb 2014 um 10:14 Uhr


It might be a better idea to use the system locale as default:

import locale
locale.setlocale(locale.LC_ALL, '')

### edit this page to your liking ###
#    <()> *free hugs* <(^o^)>    #

### enter or select your locale setting: ###
myLocale = locale.getlocale()
#myLocale = 'de_DE.UTF-8'
#myLocale = 'en_GB.UTF-8'
#myLocale = 'el_GR.UTF-8'
#myLocale = 'en_US.UTF-8'

so it uses my system's default formatting (i.e. 17/02/14 not 17.02.14).

Link to comment

thank you for your reply.

I live in germany and my native language is german. My System is also configured german. When I use your script it takes an english language locale. What I want is an output like

Montag 17.Feb.2014 um 16:39 Uhr

Montag (dt.) = Monday (en.)

I don't know why it cannot find out my real system's locale. So I decided to manually implement the locale by defining myLocale in the first script.


[ locale.setlocale(locale.LC_ALL, '') ] is called in the executed script [ main.py ] in the workflows directory. You don't need to execute it manually in the first script. If you want to use an english locale you can either use [ myLocale = 'en_GB.UTF-8' ] or [ myLocale = locale.getlocale() ]. The last only works properly if you first define [ import locale ] of course.


Have fun =)


Question to all users: Would you like to have an interface via the Alfred input window to edit your locale and your formats?

Link to comment

Yeah, I know how to set a British locale, thanks. I was suggesting a way to use the system locale automatically.


I don't know why your system uses an English locale with my edit: on mine I get the correct system locale, i.e. en_GB on my main, English-language account and de_DE on my German account.


My bad: I accidentally deleted a full stop too many from the DE date format. But yours is still lacking spaces (if you want it to be correct). It should be "17. Feb. 2014" not "17.Feb.2014".


This is how my edited script works on my system:



Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...