Interesting approach, basically adds zero padding to selective tokens.
Just wanted to note that $asctime already supports advanced date formatting...
alias formatdate { return $asctime($ctime($1), $2-) }
The only difference here is the input date must be in the British ordering of d/m/y (eg, dd/mm/yyyy or d/mm/yy etc).
And you have access to more format outputs, as well as time formats. Type /help $asctime
(yy, yyyy, m, mm, mmm, mmmm, d, dd, ddd, dddd, oo) and (hh, H, HH, n, nn, s, ss, t, tt, T, TT, z, zz, zzz)
Examples:$formatdate(28/7/2015, mm/dd/yyyy)
outputs: 07/28/2015$formatdate(28/7/2015, dddd dd mmmm yyyy)
outputs: Tuesday 28 July 2015$formatdate(28/7/2015 17:23, ddoo of mmmm @ hh:nn tt)
outputs: 28th of July @ 05:23 pm
Enjoy :)
PS. If you want a comma in your output format, you will need to use $+ $chr(44)
or pass the format in a variable.var -s %in = 28/7/2015, %fmt = mmmm dd, yyyy, %out = $formatdate(%in,%fmt)
for: July 28, 2015
Ah thanks, I see I didn't know about $asctime identifier before.