Go to:
Return value. Flags. Examples.
Synopsis
date
[-time toggle]
[-shortTime toggle]
[-date toggle]
[-shortDate toggle]
[-format string]
date is
NOT undoable, NOT queryable, and NOT editable
.
Returns information about current time and date. Use the predefined formats, or the -format flag to specify the output format.
Return value
String
Keywords
time, dateFlags
date, format, shortDate, shortTime, time
Long name (short name) | [argument types] | Properties |
---|
-time
(-t)
|
|  |
|
Returns the current time. Format is hh:mm:ss
|
|
-shortTime
(-st)
|
|  |
|
Returns the current time. Format is hh:mm
|
|
-date
(-d)
|
|  |
|
Returns the current date. Format is YYYY/MM/DD
|
|
-shortDate
(-sd)
|
|  |
|
Returns the current date. Format is MM/DD
|
|
-format
(-f)
| string |  |
|
Specifies a string defining how the date and time should be represented. All
occurences of the keywords below will be replaced with the corresponding
values:
Keyword | Becomes |
YYYY | Current year, using 4 digits |
YY | Last two digits of the current year |
MM | Current month, with leading 0 if necessary |
DD | Current day, with leading 0 if necessary |
hh | Current hour, with leading 0 if necessary |
mm | Current minute, with leading 0 if necessary |
ss | Current second, with leading 0 if necessary |
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can be used more than once in a command
|
Examples
// Get the current date and time
date;
// Result:2006/03/09 16:50:24//
// Get only the month and day
date -shortDate;
// Result:03/09//
// Get the date and time in a fancy format
date -format "year is YY (or YYYY), month is MM, day is DD. And it is now hh:mm:ss";
// Result:year is 06 (or 2006), month is 03, day is 09. And it is now 16:53:20//