Hello, Yes I have got a solution (Maybe ;) )... ####CODE#### use Time::Local; #Epoch Decleares $date = `date +%d/%b/%Y:%H:%M:%S`; $epdate = &epoch($date); ($eday, $emon, $eyear, $ehr, $emin, $esec) = &etime($epdate); print "Current Date: $date\nEpoch: $epdate\n"; printf "%2d %3s %4d %02d\:%02d\:%02d\n", $eday, $emon, $eyear, $ehr, $ +emin, $esec, $host; exit; ### Subs sub etime ##Change from Epoch Time to DMYHMS { my $date = @_[0]; my %emonths = ('1',Jan,'2',Feb,'3',Mar,'4',Apr,'5',May,'6',Jun, '7',Jul,'8',Aug,'9',Sep,'10',Oct,'11',Nov,'12',Dec); ($esec, $emin, $ehr, $eday, $emon, $eyear) = localtime($date); $eyear = $eyear+1900; $emon = $emon+1; $ehr = $ehr; #Time Zone Chang +e (Zulu) $emon = $emonths{$emon}; return ($eday, $emon, $eyear, $ehr, $emin, $esec); } sub epoch ##Change from DMYHMS to Epoch Time { my $date = @_[0]; %months = ('Jan',1,'Feb',2,'Mar',3,'Apr',4,'May',5,'Jun',6, 'Jul',7,'Aug',8,'Sep',9,'Oct',10,'Nov',11,'Dec',12); $date =~ tr/\[//d; @dates = split(/\:/, $date); @mons = split(/\//, $dates[0]); $year = $mons[2]; $mon = $mons[1]; $day = $mons[0]; $hr = $dates[1]; $min = $dates[2]; $sec = $dates[3]; my $mon = $months{$mon}; if(!($mon < 1) || ($mon > 12)) { $time = timelocal($sec, $min, $hr, $day, $mon-1, $year-1900); #con +verts to Epoch chomp($time); } return $time; } ####CODE#### ###Output#### Current Date: 16/Dec/2001:22:02:08 Epoch: 1008568928 16 Dec 2001 22:02:08 ###Output#### Hope This Helps, Joe

In reply to Re: Re: Converting date to epoch time by JoeCool
in thread Converting date to epoch time by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.