Re: Date conversion script
From: Jack Challen (jack_challen_at_ocsl.co.uk)
Date: 04/21/04
- Previous message: Joe Smith: "Re: writing duplicates in file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 21 Apr 2004 10:32:59 +0100
Jon Carpenter wrote:
> I need some help with a script I am writing. Maybe someone has some
> experience with this. I need a part of the script to take a standard input,
> a 3-digit ordinal date (e.g. 060), and convert it to the cardinal date,
> assuming the current year (e.g. 20040229). I also need to be able to
> convert parts of that string, the month, to the abbreviation (e.g. 02 to
> FEB), and put the parts of that string in different places (e.g. *29*0000 -
> *29*2359 *FEB* *2004*). This is for creating daily log reports.
#!/usr/bin/perl
use warnings;
use strict;
use Date::Calc qw/Add_Delta_Days/;
my $current_year = (localtime)[5]+1900;
my $ordinal = 60;
my ($year, $month, $mday) = Add_Delta_Days($current_year, 1, 1, $ordinal-1);
my $month_t = (qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/)[$month-1];
print "$mday $month_t $year\n";
- Previous message: Joe Smith: "Re: writing duplicates in file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|