Ready made module in Perl to convert epoch time to DB2 or Human timestamp formats (YYYY-MM-DD HH:MM:SS)
Write a function convertEpochToHumanTimestamp and call this from the required sub.
# Function : convertEpochToHumanTimestamp
# Description : Convert Epoch into a formatted time suitable for insertion into a Human database timestamp
# column. The output format is “YYYY-MM-DD HH:MM:SS”my $inputEpoch = shift;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($inputEpoch);
$mon++;
$year = $year + 1900;
my $humanTime = sprintf (“%04d-%02d-%02d %02d:%02d:%02d”, $year, $mon, $mday, $hour, $min, $sec);return ($humanTime);
'Programming > Perl' 카테고리의 다른 글
[Perl] Beginning Perl Tutorial - Installing and Using MySQL (0) | 2014.01.29 |
---|---|
[Perl] Perl DBI examples for DBD::mysql (0) | 2014.01.29 |
[Perl] PERL - MySQL Query (0) | 2014.01.29 |
[Perl] Port Scanner (포트 스캐너) (0) | 2014.01.29 |
[Perl] easiest way to convert an epoch time to a human-readable datetime (0) | 2014.01.29 |
[Perl] How can I convert epoch seconds to date format (0) | 2014.01.29 |
[Perl] Perl Epoch Converter Routines (0) | 2014.01.29 |
[Perl] Formatting dates with strftime (0) | 2014.01.29 |
[Perl] Epoch Time(Unix Time) 구하는 방법 (0) | 2014.01.29 |
[Perl] 펄 프로그래밍 기초 #1 (Beginner's Introduction to Perl #1) (0) | 2014.01.29 |