Difference between revisions of "$time"
From Scriptwiki
Line 1: | Line 1: | ||
− | Returns the current time in hour:minute:second format. | + | Returns the current time in hour:minute:second format, or whatever format specified. |
− | $time | + | $time(format) |
− | + | The following characters are recognized in the ''format'' parameter string. | |
+ | |||
+ | '''NAME''' '''USAGE''' '''EXAMPLE''' | ||
+ | Year yy 99 | ||
+ | yyyy 1999 | ||
+ | Month m 1 | ||
+ | mm 01 | ||
+ | mmm Jan | ||
+ | mmmm January | ||
+ | Day d 1 | ||
+ | dd 01 | ||
+ | ddd Mon | ||
+ | dddd Monday | ||
+ | Hours h 5 | ||
+ | hh 05 | ||
+ | H 13 | ||
+ | HH 13 | ||
+ | Minutes n 1 | ||
+ | nn 01 | ||
+ | Seconds s 1 | ||
+ | ss 01 | ||
+ | AM/PM t a/p | ||
+ | tt am/pm | ||
+ | T A/P | ||
+ | TT AM/PM | ||
+ | Ordinal oo st/nd/rd/th | ||
+ | Timezone z +0 | ||
+ | zz +0000 | ||
+ | zzz +0000 GMT | ||
== Example == | == Example == | ||
$time ;returned ''11:50:34'' just now | $time ;returned ''11:50:34'' just now | ||
+ | $time(yyyy) ;returned ''2005'' just now | ||
+ | $time(HH:nn dddd dd/mm/yyyy) ;returned ''11:50 Saturday 26/11/2005'' just now | ||
== See Also == | == See Also == |
Revision as of 12:05, 26 November 2005
Returns the current time in hour:minute:second format, or whatever format specified.
$time(format)
The following characters are recognized in the format parameter string.
NAME USAGE EXAMPLE Year yy 99 yyyy 1999 Month m 1 mm 01 mmm Jan mmmm January Day d 1 dd 01 ddd Mon dddd Monday Hours h 5 hh 05 H 13 HH 13 Minutes n 1 nn 01 Seconds s 1 ss 01 AM/PM t a/p tt am/pm T A/P TT AM/PM Ordinal oo st/nd/rd/th Timezone z +0 zz +0000 zzz +0000 GMT
Example
$time ;returned 11:50:34 just now $time(yyyy) ;returned 2005 just now $time(HH:nn dddd dd/mm/yyyy) ;returned 11:50 Saturday 26/11/2005 just now
See Also
$asctime and $ctime is often used for more detailed date/time information.