Platinum Partner

Epoch2gmt - Convert Seconds To Time...

//
// Convert seconds since the epoch to a normal time string...
//
// You can do:
//


# $ date +'%s'


// to generate seconds since the epoch... or of course:


$ perl -e 'print time, $/;'


// The program...


#!/usr/bin/perl

use warnings;
use strict;

my $time = shift;

die "Usage: $0 [TIME_IN_SECS_SINCE_EPOCH]\n" unless $time;

my @mon  = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
my @day  = qw( Sun Mon Tue Wed Thu Fri Sat );

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
    = gmtime($time);

printf "%4d-%02d-%02d %02d:%02d:%02d (%s %02d %s %04d)\n",
    $year + 1900, $mon + 1, $mday, $hour, $min, $sec,
    $day[$wday], $mday, $mon[$mon], $year + 1900;

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}