Home

Awesome

alfred-workflow-moment

Advanced time utility for Alfred workflow. Inspired by moment.js and [alfred-datetime-format-converter].

DOWNLOAD LINK

command

now m

Get current timestamp and formatted time.

format-moment

List all saved time formats, press CMD+ENTER to delete.

format-moment add <format string>

Add a time format to storage, which can be used for moment.

moment [arg]... m [arg]...

Calculate timestamp by arguments. There is servals calculate command:

<timestamp>:

Init/reset time. both UNIX timestamp and timestamp with milliseconds are supported. For example: moment 1455624282913 or moment 1455624282.

moment 1455624282913

<operator> <attribute>

Shift time. operator is like +1, -100. attribute is like year, month, day. For example: moment +1 day.

moment +1 day

set <attribute> <number>

Replace specified attribute. For example: moment set hour 4 set tz -7

moment set hour 4 set tz -7

start of <attribute>

Get start of the time span which split by specified attribute. For example moment start of year.

moment start of year

end of <attribute>

Get end of the time span which split by specified attribute. For example moment end of year.

moment end of year

format <format string>

Format time by specified format. If there is no format command, moment will use saved format string to format time, or a default format. For example moment format MMMM DD, YYYY.

moment format MMMM DD, YYYY

Combine command

Combination of commands is acceptable. For example: moment 1455626556616 start of minute set hour 4 set day 1 end of minute .

combination of commands

Please note that the format command will all rest arguments as format string, so format command should always be the last command.

supported time attributes

attributealiasvalue
yeary
monthM1 - 12
dayd1 - 31
hourh0 - 23
minutem0 - 59
seconds0 - 59
timezonetz-12 - +12 (number without plus is ok)

supported format token

Because python library arrow is chosen to deal with time, you can use the following tokens for formatting and parseing time:

TokenOutput
YearYYYY2000, 2001, 2002 ... 2012, 2013
YY00, 01, 02 ... 12, 13
MonthMMMMJanuary, February, March ...
MMMJan, Feb, Mar ...
MM01, 02, 03 ... 11, 12
M1, 2, 3 ... 11, 12
Day of YearDDDD001, 002, 003 ... 364, 365
DDD1, 2, 3 ... 4, 5
Day of MonthDD01, 02, 03 ... 30, 31
D1, 2, 3 ... 30, 31
Do1st, 2nd, 3rd ... 30th, 31st
Day of WeekddddMonday, Tuesday, Wednesday ...
dddMon, Tue, Wed ...
d1, 2, 3 ... 6, 7
HourHH00, 01, 02 ... 23, 24
H0, 1, 2 ... 23, 24
hh01, 02, 03 ... 11, 12
h1, 2, 3 ... 11, 12
AM / PMAAM, PM, am, pm
aam, pm
Minutemm00, 01, 02 ... 58, 59
m0, 1, 2 ... 58, 59
Secondss00, 01, 02 ... 58, 59
s0, 1, 2 ... 58, 59
SS00, 01, 02 ... 98, 99
S0, 1, 2 ... 8, 9
TimezoneZ+0800
ZZ+08:00
TimestampX1381685817

License

MIT