#!/usr/bin/perl -w use strict; use Time::Local; my $test = "G: CCCCC-01 :ADD : ORDER PROCESSED : *** OK ***:08/30/2003:14:24:58"; my $datetemp = substr($test,index($test,"***:")+4,length($test)-index($test,"***:")+4); print "DATE & TIME: $datetemp\n"; my $date = substr($datetemp,0,index($datetemp,":")); print "DATE ONLY: $date\n"; my $time = substr($datetemp,index($datetemp,":")+1,length($datetemp)-index($datetemp,":")); print "TIME ONLY: $time\n"; my @datearray = split(/\//,$date); my @timearray = split(/:/,$time); my $ticks = timelocal($timearray[2],$timearray[1],$timearray[0],$datearray[1],$datearray[0]-1,$datearray[2]); print "CLOCK TICKS SINCE THE EPOCH: $ticks\n"; #usage of the timelocal function # my $time = timelocal($sec,$min,$hour,$mday,$month,$year);