[NCLUG] perl datestring to timestamp conversion ?

dann frazier dannf at dannf.org
Mon Jan 10 11:48:53 MST 2005


On Mon, Jan 10, 2005 at 11:24:34AM -0700, Gabriel Somlo wrote:
> Hi,
> 
> I'm trying to write a perl script that receives a bunch of lines
> containing time stamps formatted like so:
> 
> 	YYYY-MM-DD hh:mm:ss [utc]

If this is the entire purpose of your script, you maybe able to just
use the date command instead:

$ date -d "2005-12-01 12:12:12 utc"
Thu Dec  1 05:12:12 MST 2005
$ date -d "2005-12-01 12:12:12"
Thu Dec  1 12:12:12 MST 2005

date supports format strings for specifying output style.



More information about the NCLUG mailing list