O'Reilly logo

Learning AWK Programming by Shiwang Kalkhanda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The mktime (datespec) function

The mktime function converts the datespec string into a timestamp of the same format as returned by the systime() function, the number of seconds elapsed since the epoch. The datespec is a string of the YYYY MM DD HH MM SS format :

$ vi mktime.awkBEGIN    {    print "Number of seconds since the Epoch"    print "mktime(\"2018 01 15 20 20 10\") : " mktime("2014 12 14 30 20 10")}$ awk -f mktime.awk

The output of the execution of the previous code is as follows:

Number of seconds since the Epochmktime("2018 01 15 20 20 10") : 1418604610

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required