Convert Unix_timestamp string in Perl

A place for discussion of topics that are not specific to ZoneMinder. This could include Linux, Video4Linux, CCTV cameras or any other topic.
Post Reply
jnk1690
Posts: 30
Joined: Wed Jul 30, 2008 1:52 pm

Convert Unix_timestamp string in Perl

Post 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
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post 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;
Phil
Post Reply