Perl Code - Detail View


Date

Name

Plattform

Language

Kurzbeschreibung

Owner

Link

31.08.2002

Epoch Seconds->Date

Unix

Perl

Umwandlung Epoch Seconds in ein Datum

Gernot Ruban

 

#!/usr/local/bin/perl -w
use Time::localtime;
use strict;
my $tm;
my $es = $ARGV[0];
$tm = localtime($es);
printf("Datum: %02d:%02d:%02d-%04d/%02d/%02d\n",
$tm->hour, $tm->min, $tm->sec,
$tm->year+1900, $tm->mon+1, $tm->mday);
printf("Epoch Seconds: %12d\n",$es);
exit;

Man beachte: mon+1 und year+1900!

DB2 ist ein Produkt der
IBM Corporation. Bitte
Copyright-  und Trademark-Hinweise beachten!

© Gernot Ruban