manipulating_date_strings
This is an old revision of the document!
Print file modification times:
$filename = "201010211800_a.png"; $mtime = (stat $filename)[9]; chomp($mtime); $mtime_date = `/bin/date --date='Jan 1, 1970 00:00:00 +0000 + $mtime seconds' '+%A, %d %B %Y %H:%M:%S %Z'`; Output is: Thursday, 21 October 2010 22:21:49 UTC
Querying a specific timezone to determine DST:
[cjuckins@lnxopc2: ~]$ zdump America/New_York America/New_York Tue May 3 13:41:20 2011 EDT [cjuckins@lnxopc2: ~]$ zdump America/Los_Angeles America/Los_Angeles Tue May 3 10:41:52 2011 PDT
Other file stats info: http://perldoc.perl.org/functions/stat.html
Using Linux 'date' to print a time:
[juckins@lightning: /var/www/html/amtrak_status]$ date --date="Sat Nov 19 2011 11:00 pm" Sat Nov 19 23:00:00 EST 2011
Using Linux 'date' to compute a time based upon a given time and some offset value:
[juckins@lightning: /var/www/html/amtrak_status]$ date --date="Sat Nov 19 2011 11:00 pm 2 hours 30 minutes" Sun Nov 20 01:30:00 EST 2011 [juckins@lightning: /var/www/html/amtrak_status]$ date --date="Sat Nov 19 2011 11:00 pm 30 minutes 2 hours ago" Sat Nov 19 21:30:00 EST 2011
manipulating_date_strings.1321803503.txt.gz · Last modified: 2011/11/20 10:38 by juckins