Veritas-bu

[Veritas-bu] converting unix time

2001-03-09 09:52:00
Subject: [Veritas-bu] converting unix time
From: Ron Jack (Programming) rjack AT nando DOT com
Date: Fri, 9 Mar 2001 09:52:00 -0500
I'm lazy when it comes to date conversion; I let Perl's Date::Manip and
Date::Calc handle it.


#!/usr/local/bin/perl -w

use strict;

use Date::Manip qw(ParseDate UnixDate);
use Date::Calc qw(:all);

my $string_date = "today";
my $date = ParseDate($string_date);

if(!$date) {
   warn "Bad date string: $_\n";
}
else {

   my $unixdate = UnixDate($date,"%s");
   print "The current epoch time is $unixdate\n";

   my ($year,$month,$day) = UnixDate($date,"%Y","%m","%d");
   print "Today's date is $month/$day/$year\n";

   my ($y,$m,$d) = Nth_Weekday_of_Month_Year($year,$month,7,1);
   print "The first Sunday of this month was on $m/$d/$y\n";
}


Yep, you have to go get the modules.

http://search.cpan.org/search?dist=DateManip

http://search.cpan.org/search?dist=Date-Calc

-----Original Message-----
From: Zufall, Ken <KZufall AT officemax DOT com>
To: 'Tim Allen' <tallen201 AT hotmail DOT com>; veritas-bu AT 
mailman.eng.auburn DOT edu
<veritas-bu AT mailman.eng.auburn DOT edu>
Date: Wednesday, March 07, 2001 4:44 PM
Subject: RE: [Veritas-bu] converting unix time


>/usr/openv/netbackup/bin/bpdbm -ctime unix_time
>
>This is the command to use, am unaware of any scripts that might do the
same
>thing.
>
>Now, here's a question for everyone: How do you convert date/time format to
>unix time?
>
>Ken Zufall
>Technical Analyst
>Phone: 216.471.3613
>Pager: 440.303.1656
>Fax: 216.491.4051
>
>"It's not the most intellectual job, but I do have to know all the
letters."
>Vanna White





<Prev in Thread] Current Thread [Next in Thread>