Page 1 of 1

Convert Unix_timestamp string in Perl

Posted: Fri Nov 07, 2008 9:26 pm
by jnk1690
Hi,

I'm making a small mod to the zmvideo script to add the time and date to the Mpg file name.

Could someone suggest how to convert the unix_timestamp string from
'2007-10-04 22:23:00'

to '2007-10-24_22_23_00' in perl ?? I'm definitely not a perl expert.

Thanks in advance,

Joel

Posted: Wed Nov 12, 2008 10:28 pm
by zoneminder
You just want to substitute space and colons for underscores?

If so then this will work I think

Code: Select all

$str = '2007-10-04 22:23:00' ;
$str =~ s/[ :]/_/g;