- TimeStamp vers Date
$ perl -e "print scalar(localtime(1173279767))"
- Date vers TimeStamp
$ perl -MPOSIX -e "print (mktime(10,45,11,31,4,107));"
Avec :
# mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
#
# The month (mon), weekday (wday), and yearday (yday) begin at zero.
# The year (year) is given in years since 1900.
# Sunday is 0, not 1;
# January 1st is 0, not 1.
#
# I.e. January is 0, not 1;
# I.e. The year 1995 is 95; the year 2001 is 101.
# I.e. Calendar time for December 12, 1995, at 10:30 am : mktime( 0, 30, 10, 12, 11, 95 );
#
# Greenwich Mean Time (GMT)
# Daylight saving Time (DST)
# Coordinated Universal Time (CUT)
##################################



Timestamp vers Date, c’est très pratique de pouvoir le faire en uniligne.
Par contre, dans l’autre sens, on peut aussi faire :
date -d ‘format de date’ +’%s’