Bad news: Standard awk
doesn't have date handling capabilities, and date handling is a hit or miss affair for shell scripts. Both GNU and BSD versions of the date
command can use the date command to check a date, but both use completely different syntax for doing so.
If you're using gawk
or Linux with awk
, you can try the mktime
function:
date="20141225011522" # December 25, 2014 at 1:15:22
date_in_seconds = mktime( date )
You'll need to do a bit of reformatting with your dates, but once done, you'll get back the date in the number of seconds since the epoch which is usually January 1, 1970.
By the way, you need to include examples of what you tried, and the problems you ran into in the code itself, or else your question will be closed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…