waltzofpearls / dateparser

Parse dates in commonly used string formats with Rust.
MIT License
41 stars 8 forks source link

awk mktime date format support #45

Open linux-china opened 7 months ago

linux-china commented 7 months ago

Thanks for good library to parse date. I use AWK daily, could you support gawk mktime date format?

mktime(datespec [, utc-flag ]) Turn datespec into a timestamp in the same form as is returned by systime(). It is similar to the function of the same name in ISO C. The argument, datespec, is a string of the form "YYYY MM DD HH MM SS [DST]". The string consists of six or seven numbers representing, respectively, the full year including century, the month from 1 to 12, the day of the month from 1 to 31, the hour of the day from 0 to 23, the minute from 0 to 59, the second from 0 to 60,58 and an optional daylight-savings flag.

$ echo | awk '{print strftime("%d-%m-%Y",mktime("2012 12 21 0 0 0"));}'
21-12-2012

https://www.gnu.org/software/gawk/manual/html_node/Time-Functions.html