Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


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

manipulating_date_strings.1304509929.txt.gz · Last modified: 2011/05/04 07:52 by juckins