|
#!/usr/bin/perl -w use strict; my $EPOCH; $EPOCH=shift(@ARGV) || 991231995; sub convert_epoch($EPOCH_SECS){ my $EPOCH_SECS=shift; print "Epoch seconds: ",$EPOCH_SECS; print "\nDate: ",scalar(localtime($EPOCH_SECS)),"\n"; }#endsub &convert_epoch($EPOCH); |
|
#!/usr/bin/perl -w use strict; my $EPOCH; $EPOCH = shift(@ARGV) || 991231995; sub epoch_conversion($EPOCH_SECS) { my $EPOCH_SECS = shift; my ($seconds,$minutes,$hours,$day_of_month,$month,$year,$wday,$yday,$isdst); print "Epoch seconds: ",$EPOCH_SECS; print "\nDate returned from passing Epoch seconds to localtime: "; print scalar(localtime($EPOCH_SECS)); ($seconds,$minutes,$hours,$day_of_month,$month,$year,$wday,$yday,$isdst)=localtime($EPOCH_SECS); print "\n\nSeconds: ",$seconds; print "\nMinutes: ",$minutes; print "\nHours: ",$hours; print "\nDay of month: ",$day_of_month; print "\nMonth (where 0 = January): ",$month; print "\nYear (since 1900): ",$year; print "\nDay of week: ",$wday; print "\nDay of year: ",$yday; print "\nDaylight savings time (0 or 1): ",$isdst,"\n"; }#endsub &epoch_conversion($EPOCH); |