datetime - convert localtime to utc time in perl -


i calculated time 10 minutes before current time. need convert utc time using perl script. please help. have used code :-

my $dt = time(); $dt = $dt - 10 * 60;   # 10 minutes before of current date. 

i want time in format :-

2014-08-14t05:52:16.

you should consider using strftime, available via posix module. see:

perldoc posix 

for information on module, and

man strftime 

for information on function. use e.g.

#!/usr/bin/perl -w  use strict; use warnings;  use posix qw(strftime);  $dt = time(); $dt -= 10 * 60;  print "datetime: ", strftime('%y-%m-%dt%h:%m:%s.', gmtime($dt)), "\n"; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -