MySQL Forums
Forum List  »  Perl

Re: INSERT in Perl
Posted by: Tony Darnell
Date: September 08, 2011 01:47PM

Here is how you can find the current time:

# grab the local time variables
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
#Zero padding
$mday = '0'.$mday if ($mday<10);
$mon = '0'.$mon if ($mon<10);
$hour = "0$hour" if $hour < 10;
$min = "0$min" if $min < 10;


use POSIX ‘strftime’; # Need to explicitly load the functions in POSIX

# Note that if you pass no argument to localtime, it assumes the current time
my $localtime = strftime ‘%Y-%m-%d-%H%M’, localtime;

Options: ReplyQuote

Written By
August 04, 2011 09:40AM
August 04, 2011 01:14PM
August 04, 2011 03:20PM
Re: INSERT in Perl
September 08, 2011 01:47PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.