WolframLang: Date Time
DateObject[]
- return current local date DateObject
DateObject[{y,m,d,h,m,s}]
- return a date object. The argument is {year, month, date, hour, minutes, seconds}. Any of the smaller time unit can be omitted.
Now
- return a
DateObject
of current date and time. NowNow (* DateObject[{2022, 7, 17, 13, 51, 20.2956073`9.059976985734098}, Instant, Gregorian, -7.] *)
DateString[]
- return current datetime string.
DateString
DateString[ ] (* Mon 22 Nov 2021 21:25:08 *)
DateString[date]
- convert date to string.
DateString[date, format]
- use format. Named format includes the following and more, see example:
xx=DateObject[{2022,7,17,14,20,58}]; DateString[ xx , "ISODate" ] === "2022-07-17" DateString[ xx , "ISODateTime" ] === "2022-07-17T14:20:58" DateString[ xx , "Time" ] === "14:20:58" DateString[ xx , "Date" ] === "Sunday 17 July 2022" DateString[ xx , "DateShort" ] === "Sun 17 Jul 2022" DateString[ xx , "DateTime" ] === "Sunday 17 July 2022 14:20:58" DateString[ xx , "DateTimeShort" ] === "Sun 17 Jul 2022 14:20:58"