On 25.07.2014 18:54, Chris Knipe wrote:
I have the odd (very rare) case where I am given a date in an incorrect
format. I already use Date::Parse to convert the dates to a unix
timestamp, and it’s working incredibly well. However, on the rare case
that I get incorrect dates, Date::Parse does
On 25/07/2014 17:54, Chris Knipe wrote:
Hi All,
I have the odd (very rare) case where I am given a date in an incorrect
format. I already use Date::Parse to convert the dates to a unix
timestamp, and it’s working incredibly well. However, on the rare case
that I get incorrect dates, Date
On Jul 25, 2014, at 9:54 AM, Chris Knipe wrote:
> Hi All,
>
> I have the odd (very rare) case where I am given a date in an incorrect
> format. I already use Date::Parse to convert the dates to a unix timestamp,
> and it’s working incredibly well. However, on the rare
On Fri, Jul 25, 2014 at 6:54 PM, Chris Knipe wrote:
> Hi All,
>
>
>
> I have the odd (very rare) case where I am given a date in an incorrect
> format. I already use Date::Parse to convert the dates to a unix timestamp,
> and it’s working incredibly well. However, on the
On Fri, Jul 25, 2014 at 7:12 PM, Andy Bach wrote:
>
> On Fri, Jul 25, 2014 at 11:54 AM, Chris Knipe wrote:
>>
>> Thu, 23 Oct 2008 12:06:48+0400
>>
>>
>>
>> Note the lack of a space between the seconds and the timezone.
>
>
> Well, depending upon the consistency of your one bad case (presuming the
On Fri, Jul 25, 2014 at 11:54 AM, Chris Knipe wrote:
> Thu, 23 Oct 2008 12:06:48+0400
>
>
>
> Note the lack of a space between the seconds and the timezone.
>
Well, depending upon the consistency of your one bad case (presuming the
date string is in $_ for the moment):
if ( s/(\w+, \s+ \d+ \s+ \
On Fri, 25 Jul 2014 18:54:25 +0200
Chris Knipe wrote:
> Is there a simple quick way to fix that by means of a regex?
Have you checked Regexp::Common ? It has a whole bunch of date regexps.
--
Don't stop where the ink does.
Shawn
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.
Hi All,
I have the odd (very rare) case where I am given a date in an incorrect
format. I already use Date::Parse to convert the dates to a unix timestamp,
and it's working incredibly well. However, on the rare case that I get
incorrect dates, Date::Parse does not like them either and e
Bill Stephenson wrote:
When converting DMYHMS to Epoch Seconds and back I get cheated out of a day.
Why?
Bill
--
#!/usr/bin/perl
use strict;
use warnings;
use Time::Local;
my ($time, $month, $day, $year, $seconds, $minutes, $hours, $wday, $yday,
$isdst);
my $start_date = '11/30/2012';
pr
The output depends on the timezone that you have set on your machine. You can
toy around and try different ones with
$ENV{TZ} = 'Europe/Vienna'; or
$ENV{TZ} = 'America/Los_Angeles';
If you don't want to depend on the timezone use gmtime instead of localtime.
Bill Stephenson hat am 18. Januar 201
year+1900);
print "$month/$day/$year \n";
-Original Message-
From: "Bill Stephenson"
Sent: Friday, January 18, 2013 3:13pm
To: "Perl Beginners"
Subject: converting dates to epoch seconds and back
When converting DMYHMS to Epoch Seconds and back I get cheated out of
When converting DMYHMS to Epoch Seconds and back I get cheated out of a day.
Why?
Bill
--
#!/usr/bin/perl
use strict;
use warnings;
use Time::Local;
my ($time, $month, $day, $year, $seconds, $minutes, $hours, $wday, $yday,
$isdst);
my $start_date = '11/30/2012';
print "$start_date \n";
($
e you
assuming the current year for all dates?
I need to read these files from from the first date(Dec 5 09:02:01) till
> the last date (Dec 17 17:34:02) in the file. Then i have to search a word
> between the time difference of one minute and i have to count that how many
> times tha
How do I unsubscribe from this list?? I tried a few times without success!
-Original Message-
From: Raheel Hassan [mailto:raheel.has...@gmail.com]
Sent: Saturday, December 17, 2011 5:58 PM
To: beginners@perl.org
Subject: Problems in dates and time additions by one minute.
Hi,
I
Raheel Hassan wrote:
Hi,
Hello,
I have 3 files (these are the log files of the system). These files have
date formate like this (Dec 5 09:02:01).
Most date fields also have the year but your's doesn't appear to. Are
you assuming the current year for all dates?
I need to
handle these dates. I have read about the Time::Local but that
did not solve my problem.
I will be very thankful for any help.
Raheel
of bad design.
b. Is it possible, to have dates as index? I am trying to parse and process data
corresponding to a list of "trades" I have made(financial trades) and want to
see, how my portfolio varies with time. So is it possible to do in such a way?
Just format them as a string
r...@i.frys.com wrote:
Soham Das wrote:
int a[125];
for(i=0;i<125;i++)
a[i]=0;
my @array;
$array[$_] = 0 for 0..125;
s/125/124/
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: be
Soham Das wrote:
My agenda actually is two pronged. I have read Beginning Perl and a bit of
Intermediate Perl, though was able to solve individual problems, but I was not
sure,if I can code myself out of a wet paperbag.
So I thought, lets chuck theory. Its better to get hands dirty with some r
Soham
- Original Message
From: Shawn H Corey
To: Uri Guttman
Cc: Soham Das ; beginners@perl.org
Sent: Monday, 28 September, 2009 10:45:33 PM
Subject: Re: Arrays, Dates, Indexing and Initialisation
Uri Guttman wrote:
> only for ++/-- and +=/-= will that work with no warnings. if he uses an
> un
Uri Guttman wrote:
only for ++/-- and +=/-= will that work with no warnings. if he uses an
undef value in another arithmetic expression it will warn.
Also, undef values work in if/unless and while/until conditions.
Usually when you see indexes used with arrays, it is because the
programmer do
> "SHC" == Shawn H Corey writes:
SHC> Soham Das wrote:
>> a.. How do I initialise an array of a definite size with zero. Say the C
equivalent of such a statement will be:
>> int a[125];
>> for(i=0;i<125;i++)a[i]=0;
SHC> Not needed. Perl assume zero if a non-ex
> "JK" == Jenda Krynicky writes:
>> >
>> > a.. How do I initialise an array of a definite size with
>> > zero. Say the C equivalent of such a statement will be:
>> my @array;
>> $array[$_] = 0 for 0..125;
JK> my @array = (0) x 126;
and a question for the OP is why do you need t
Thanks Shawn, yes hashes I guess will be the way to go forward.
Soham
- Original Message
From: Shawn H Corey
To: Soham Das
Cc: beginners@perl.org
Sent: Monday, 28 September, 2009 9:50:18 PM
Subject: Re: Arrays, Dates, Indexing and Initialisation
Soham Das wrote:
> a.. How d
Wow! sweet!
Hi Jenda, thanks for the help.
And I guess, for the dates problem I have to use hashes, eh?
Soham
- Original Message
From: Jenda Krynicky
To: beginners@perl.org
Sent: Monday, 28 September, 2009 9:50:40 PM
Subject: Re: Arrays, Dates, Indexing and Initialisation
Date
is used in an
arithmetic expression.
perl -e '$a[$_] += int(rand(10)) for 0..10;print"@a\n"'
b. Is it possible, to have dates as index? I am trying to parse and process
data corresponding to a list of "trades" I have made(financial trades) and
want to see, how my
Date sent: Mon, 28 Sep 2009 09:11:02 -0700
Subject:Re: Arrays, Dates, Indexing and Initialisation
From: r...@i.frys.com
To: "Soham Das"
Copies to: beginners@perl.org
> Soham Das wrote:
> > Hello Al
for(i=0;i<125;i++)
>a[i]=0;
>
my @array;
$array[$_] = 0 for 0..125;
> b. Is it possible, to have dates as index? I am trying to
> parse and process data corresponding to a list of "trades"
> I have made(financial trades) and want to see, how my
> portfolio
it possible, to have dates as index? I am trying to parse and process
data corresponding to a list of "trades" I have made(financial trades) and want
to see, how my portfolio varies with time. So is it possible to do in such a
way?
Hoping for some insights,
Soham
P.S: Would like to
Mihir Kamdar wrote:
> i am sorry Steve...actually I miswrote DateTime instead of DateManip...
>
> i saw your code using DateTime but I before I posted this, I was trying
> using DateManip...but while testing the code, I found out that DateManip
> is not installed...
>
> i tried executing your c
=> 2009,
>month => 3,
>day => 31
>);
>
>
># turn the extracted date string into a DateTime object
>
>my $date_formatter
>= new DateTime::Format::Strptime( pattern =
);
# turn the extracted date string into a DateTime object
my $date_formatter
= new DateTime::Format::Strptime( pattern => '%d-%b-%y' );
my $voucher_date
= $date_formatter->parse_datetime($date_string);
# compare the DateTime compiled dates
>>> DateTime??
>>>
>>
>> As always, TIMTOWTDI, but I have to maintain a lot of legacy code, where
>> the original author (including myself) would rewrite date routines
>> (differently) in each subroutine that needed to parse/manipulate dates.
>>
> -Original Message-
> From: Mihir Kamdar [mailto:kamdarmihi...@gmail.com]
> Sent: Tuesday, August 18, 2009 08:55
> To: Steve Bertrand
> Cc: beginners
> Subject: Re: script to compare dates
>
> I dont have Datetime module installed. Is there a way
that needed to parse/manipulate dates.
I would highly advise that you get DateTime installed at any cost. It is
consistent, extremely flexible, and very well maintained and documented.
There is also a spectacular number of different formatting modules as
well that make all tasks involving dates
parse/manipulate dates.
I would highly advise that you get DateTime installed at any cost. It is
consistent, extremely flexible, and very well maintained and documented.
There is also a spectacular number of different formatting modules as
well that make all tasks involving dates easy and enj
de from DateTime (it's very not worth it,
except perhaps as a learning exercise or masochism).
More seriously getting date arithmetic right can be very hard. Your
particular need doesn't sound too complicated now (compare two dates to a
fixed date), but I still wouldn't choose
7,,*31-DEC-08*
> > ,10,INR,,VOUCHER_BATCH_20080919_00024,1K,,0
> >
> > Here I want to compare whether the 5th field, which is the date field
> > is *earlier
> > than 31-Mar-09 and 2nd field value is 2.*
> >
> > If yes, then I will take that record and s
d field value is 2.*
>
> If yes, then I will take that record and store it in another file.
>
> Please help me as to how do I compare dates, preferably with some sample
> code.
>
> I started coding for this as below, but am stuck on how to compare date in
> my input
help me as to how do I compare dates, preferably with some sample
code.
I started coding for this as below, but am stuck on how to compare date in
my input with another date.
#!/usr/bin/perl
use strict;
use warnings ;
open (my $IN_FILE,"<","testdata.txt") or die $!."
itshardtogetone wrote:
- Original Message - From: "John W. Krahn" <[EMAIL PROTECTED]>
use Time::Local;
my $start = timegm 0,0,0,1,0,60;
my $end = timegm 0,0,0,1,0,86;
print scalar gmtime $start + rand $end - $start;
Hi,
Thanks.
(1) But the above from time to time produce the fol
1960 to 1985 using
rand like this :
my $year = int (rand 26) + 1960;
use Time::Local;
my $start = timegm 0,0,0,1,0,60;
my $end = timegm 0,0,0,1,0,86;
print scalar gmtime $start + rand $end - $start;
Time::Local only works for dates between Jan. 1, 1959 and Dec. 31, 2038.
For dates outside of
duce a random number between 1960 to 1985 using
> > rand like this :
> >
> > my $year = int (rand 26) + 1960;
>
> use Time::Local;
>
> my $start = timegm 0,0,0,1,0,60;
> my $end = timegm 0,0,0,1,0,86;
>
> print scalar gmtime $start + rand $end - $start;
T
itshardtogetone wrote:
Hi,
Hello,
How do I randomly produce a date between 1st Jan 1960 to 31th December
1985. It must be able to show the day month year.
I only know how to produce a random number between 1960 to 1985 using
rand like this :
my $year = int (rand 26) + 1960;
use Time::Local
Hi,
How do I randomly produce a date between 1st Jan 1960 to 31th December 1985. It
must be able to show the day month year.
I only know how to produce a random number between 1960 to 1985 using rand like
this :
my $year = int (rand 26) + 1960;
Thanks
John W. Krahn wrote:
} elsif ( $ARGV[0] =~
m/\b2008(0[1-9]|1[12])(0[1-9]|1[0-9]|2[0-9]|3[01])([01][0-9]|2[0-3])\b/
) {
^
So you don't want to test for October?
John
fixed now. thanks!!
} elsif ( $ARGV[0] =~
m/\b2008(0[1-9]|1[012])(0[1-9]|1[0-9]|2[0-9]|3[01])([01][
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
given then ARGV[0] is 2008052803, why woulnd't below regex match them??
2008052803 is a ten digit number.
} elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) {
Your pattern matches eight digits with a \b word boundary
John W. Krahn wrote:
Richard Lee wrote:
given then ARGV[0] is 2008052803, why woulnd't below regex match them??
2008052803 is a ten digit number.
} elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) {
Your pattern matches eight digits with a \b word boundary at each end
so it
John W. Krahn wrote:
Richard Lee wrote:
@array = qx#ls -tr $directory/$ARGV[0]*#;
Why not do that directly in perl:
@array = map $_->[0], sort { $a->[1] <=> $b->[1] } map [ $_, -M ],
glob "$directory/$ARGV[0]*";
Sorry, that should be:
@array = map $_->[0], sort { $b->[1] <
Richard Lee wrote:
given then ARGV[0] is 2008052803, why woulnd't below regex match them??
2008052803 is a ten digit number.
} elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) {
Your pattern matches eight digits with a \b word boundary at each end so
it will never match a ten
given then ARGV[0] is 2008052803, why woulnd't below regex match them??
} elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) {
@array = qx#ls -tr $directory/$ARGV[0]*#;
#2008052803
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED
On 9/10/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
snip
> The above is also using the qw// operator, using < and > as the
> delimiters. This creates a list of single quoted strings. So if the
snip
And the reason I chose <> is that in Perl 6 qw// is will be replaced
by the diamond operator*. Also
On Sep 10, 1:18 pm, [EMAIL PROTECTED] (Mathew Snyder) wrote:
> Thanks. But I'm confused by
>
> > my %start; @start{qw} = split /\//, shift;
> > my %end; @end{qw} = split /\//, shift;
>
> What's happening here?
Quite a bit, actually. Let's go right to left. First, shift()
without an argument
Chas Owens wrote:
> On 9/10/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
>> I have a script which has to be manually edited to run for a span of days.
>> When
>> these days are over several weeks it can be clearly tedious to enter dates in
>> -mm-dd format.
erstein [mailto:[EMAIL PROTECTED]
> Sent: 10 September 2007 14:33
> To: 'Mathew Snyder'; 'Perl Beginners'
> Subject: AW: User input: dates spanning multiple months
>
> First I would use unix internal time format(epochen).
> And I would use Date-Calc (search.cpan.org/d
On Sep 10, 7:18 am, [EMAIL PROTECTED] (Mathew Snyder) wrote:
> I have a script which has to be manually edited to run for a span of days.
> When
> these days are over several weeks it can be clearly tedious to enter dates in
> -mm-dd format. I've decided to set it up to a
-
From: Angerstein [mailto:[EMAIL PROTECTED]
Sent: 10 September 2007 14:33
To: 'Mathew Snyder'; 'Perl Beginners'
Subject: AW: User input: dates spanning multiple months
First I would use unix internal time format(epochen).
And I would use Date-Calc (search.cpan.org/dist/Date-Calc
http://www.unix.org.ua/orelly/perl/cookbook/ch03_06.htm
-Original Message-
From: Angerstein [mailto:[EMAIL PROTECTED]
Sent: 10 September 2007 14:33
To: 'Mathew Snyder'; 'Perl Beginners'
Subject: AW: User input: dates spanning multiple months
First I would use unix
Snyder [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 10. September 2007 13:18
An: Perl Beginners
Betreff: User input: dates spanning multiple months
I have a script which has to be manually edited to run for a span of
days. When these days are over several weeks it can be clearly tedious
to enter
On 9/10/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
> I have a script which has to be manually edited to run for a span of days.
> When
> these days are over several weeks it can be clearly tedious to enter dates in
> -mm-dd format. I've decided to set it up to ask f
I have a script which has to be manually edited to run for a span of days. When
these days are over several weeks it can be clearly tedious to enter dates in
-mm-dd format. I've decided to set it up to ask for user input.
What I need is some input on is how to make it create the arra
Tim Wolak wrote:
> Just a quick easy one, while printing localtime, how do I get it to
> print the full minutes and seconds, i.e. :02??
>
> Thanks,
> Tim
>
> my $date;
> my ($sec,$min,$hour,$mday,$mon,$year) = (localtime) [0,1,2,3,4,5];
> $year=$year+1900;
> $mon=$mon+1;
> $date = sprintf("%02d%0
Tim Wolak wrote:
Just a quick easy one, while printing localtime, how do I get it to
print the full minutes and seconds, i.e. :02??
Thanks,
Tim
my $date;
my ($sec,$min,$hour,$mday,$mon,$year) = (localtime) [0,1,2,3,4,5];
$year=$year+1900;
$mon=$mon+1;
$date = sprintf("%02d%02d%02d\_$hour\:$min\
Subject: dates
Just a quick easy one, while printing localtime, how do I get it to
print the full minutes and seconds, i.e. :02??
Thanks,
Tim
my $date;
my ($sec,$min,$hour,$mday,$mon,$year) = (localtime) [0,1,2,3,4,5];
$year=$year+1900; $mon=$mon+1; $date =
sprintf("%02d%02d%02d\_$hour\:$min\
Just a quick easy one, while printing localtime, how do I get it to
print the full minutes and seconds, i.e. :02??
Thanks,
Tim
my $date;
my ($sec,$min,$hour,$mday,$mon,$year) = (localtime) [0,1,2,3,4,5];
$year=$year+1900;
$mon=$mon+1;
$date = sprintf("%02d%02d%02d\_$hour\:$min\:$sec", $year,$mon,
ebony smith wrote:
> I am new to perl and need to compare some dates in a file stored in
> dd-mm- format to find out if the dates are greater than 30, 60 or 90
> days.
> However, I am not quite sure how to go about doing that in perl and I
> was wondering if anyone out there
Date::Calc
On 6/25/06, ebony smith <[EMAIL PROTECTED]> wrote:
I am new to perl and need to compare some dates in a file stored in
dd-mm- format to find out if the dates are greater than 30, 60 or 90
days.
However, I am not quite sure how to go about doing that in perl and I was
won
I am new to perl and need to compare some dates in a file stored in
dd-mm- format to find out if the dates are greater than 30, 60 or 90
days.
However, I am not quite sure how to go about doing that in perl and I was
wondering if anyone out there had any tips on how to do this.
I extract
ohnson" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], "Rafael Morales" <[EMAIL PROTECTED]>
Subject: RE: Dates again.
Date: Mon, 5 Dec 2005 10:32:29 -0800
>
>
> localtime() returns an array with populated with the details about the
> current time and date (unless y
Rafael Morales <[EMAIL PROTECTED]>:
>
>> Hi to all !!!
>>
>> Now I have a new trouble with dates. How can I know the date of 72 days ago
>> ?. For example for get 2005-12-05, I do this
>>
>> use POSIX qw(strftime
ven easier:
my $dateInThePast = time - 72 * 86400;
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, December 05, 2005 9:10 AM
To: Rafael Morales
Cc: beginners@perl.org
Subject: Re: Dates again.
I am assuming that localtime() returns the time in unix f
long these line.
Quoting Rafael Morales <[EMAIL PROTECTED]>:
> Hi to all !!!
>
> Now I have a new trouble with dates. How can I know the date of 72 days ago
> ?. For example for get 2005-12-05, I do this
>
> use POSIX qw(strftime);
>
> my $today = strftime "%Y-%m%d
Hi to all !!!
Now I have a new trouble with dates. How can I know the date of 72 days ago ?.
For example for get 2005-12-05, I do this
use POSIX qw(strftime);
my $today = strftime "%Y-%m%d", localtime();
I would like to get this date: 2005-09-21.
T
On Nov 4, Scott Taylor said:
I have a date in UT that looks like this:
"2005-11-02 01:36:00.0"
Can anyone tell me the best way to subtract 8 hours from it, or to convert
it to PDT?
I'm reading up on Date::Manip, but I don't know if that is going to help,
yet.
Date::Manip can probably do it,
Check out the Time::Local module. It will let you convert your text
date into Perl time() format.
-Original Message-
From: Scott Taylor [mailto:[EMAIL PROTECTED]
Sent: Friday, November 04, 2005 11:36 AM
To: beginners@perl.org
Subject: Dates
Hello,
I have a date in UT that looks like
Hello,
I have a date in UT that looks like this:
"2005-11-02 01:36:00.0"
Can anyone tell me the best way to subtract 8 hours from it, or to convert
it to PDT?
I'm reading up on Date::Manip, but I don't know if that is going to help,
yet.
Cheers.
--
Scott
--
To unsubscribe, e-mail: [EMAIL PR
On 8/8/05, Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote:
> On Aug 8, Kevin Old said:
>
> > I'm trying to come up with a way to automatically create a hash like
> > the following:
> >
> > It's a hash with the start and end date for each week with the start
> > date being Sunday and the end date be
On Aug 8, Kevin Old said:
I'm trying to come up with a way to automatically create a hash like
the following:
It's a hash with the start and end date for each week with the start
date being Sunday and the end date being the following Saturday.
You can use localtime() and the Time::Local modul
'start' => '05/08/05',
'end' => '05/14/05'
},
);
It's a hash with the start and end date for each week with the start
date being Sunday and the end date being the following Saturday.
I know all about Dat
Jeff Eggen wrote:
Tim Wolak <[EMAIL PROTECTED]> 06/01/2005 3:59:26 pm >>>
Hello all,
I am in need of a quick way to get the current date in the MMDD
format. This is something I would like to understand better on how to
get the date with perl. Any suggestions would be most welcome.
As per t
On Thu, 6 Jan 2005, Tim Wolak wrote:
> I am in need of a quick way to get the current date in the MMDD
> format. This is something I would like to understand better on how to
> get the date with perl. Any suggestions would be most welcome.
You need to read up on localtime.
>>> Tim Wolak <[EMAIL PROTECTED]> 06/01/2005 3:59:26 pm >>>
>Hello all,
>I am in need of a quick way to get the current date in the MMDD
>format. This is something I would like to understand better on how to
>get the date with perl. Any suggestions would be most welcome.
As per the perlch
Tim Wolak wrote:
Hello all,
I am in need of a quick way to get the current date in the MMDD
format. This is something I would like to understand better on how to
get the date with perl. Any suggestions would be most welcome.
Tim
Hi.
You're probably looking for localtime?
> perldoc -f local
Hello all,
I am in need of a quick way to get the current date in the MMDD
format. This is something I would like to understand better on how to
get the date with perl. Any suggestions would be most welcome.
Tim
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
On Jul 7, Chris Charley said:
>Like Luke's solution, but using Date::Simple which comes with the standard
>distro of Perl.
>
>#!/usr/bin/perl
>use strict;
>use warnings;
>use Date::Calc qw/ Day_of_Week Add_Delta_Days /;
This uses Date::Calc, not Date::Simple... and neither of those came with
*my*
Like Luke's solution, but using Date::Simple which comes with the standard
distro of Perl.
#!/usr/bin/perl
use strict;
use warnings;
use Date::Calc qw/ Day_of_Week Add_Delta_Days /;
my @days = (undef, qw/ Mon Tue Wed Thur Fri Sat Sun /);
if ($ARGV[0] !~ /^\d{4}-\d{2}-\d{2}$/) {
die "Date given
Luke,
Thanks!!! Works exactly as needed!
-c
On Wednesday 07 July 2004 09:41 am, Bakken, Luke wrote:
> > Hi Guys,
> >
> > I'm having a real hard time trying to figure this out..
> >
> > There are tons of modules on dates, etc, but I can't seem to
>
> Hi Guys,
>
> I'm having a real hard time trying to figure this out..
>
> There are tons of modules on dates, etc, but I can't seem to
> find one to do
> what I need.
>
> I have one date, for example: 2004-07-07.
>
> I need to take that date, g
;t be too hard I think.
ons 2004-07-07 klockan 06.03 skrev Chris Puccio:
> Hi Guys,
>
> I'm having a real hard time trying to figure this out..
>
> There are tons of modules on dates, etc, but I can't seem to find one to do
> what I need.
>
> I have one date,
Hi Guys,
I'm having a real hard time trying to figure this out..
There are tons of modules on dates, etc, but I can't seem to find one to do
what I need.
I have one date, for example: 2004-07-07.
I need to take that date, get Monday's date and Sunday's date where 2004-07-
]
Cc:
Subject: Re: Subtracting Zero Dates
they are all ready in time format, that is the problem.
Example:
$time1 = Date_to_Time($year,$month,$day, $hour,$min,$sec);
$time2 = Date_to_Time($year,$month,$day, $h
they are all ready in time format, that is the problem.
Example:
$time1 = Date_to_Time($year,$month,$day, $hour,$min,$sec);
$time2 = Date_to_Time($year,$month,$day, $hour,$min,$sec);
$difference = $time1 - $time2;
One way: Convert both dates to Perl time() format, then subtract
One way: Convert both dates to Perl time() format, then subtract.
-Original Message-
From: Werner Otto [mailto:[EMAIL PROTECTED]
Sent: Fri 6/18/2004 3:28 AM
To: [EMAIL PROTECTED]
Cc:
Subject: Subtracting Zero Dates
Hi All,
Does anyone know how to handle subtracting two dates where one might be 0
or no time or blank?
--
Kind Regards,
Werner Otto
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
evel = ( 2001-10-14 => 152, 2002-01-15 => 163, 2003-03-13 =>
>210, 2004-08-07 => 307 );
>
>And I am give some dates in between:
>
>@dates = ( 2001-12-30, 2002-03-19);
>
>I need to find what the highest level was on that date, matching
>between known dates.
)[3,4,5];
> $year += 1900;
> $month++;
> my $beginyear = &ParseDate("$year/01/01");
> my $today = &ParseDate("today");
> my $firsttues = &ParseDate("$year/01/07");
> my $endyear = &ParseDate("$ye
=> '11/14/2003',
> > > '11/15/2003' => '11/21/2003',
> > > '11/22/2003' => '11/28/2003',
> > > );
> > >
> >
> > This seemed like a fun exercise so I wrote the program below. It builds
> > an
1/2003',
> > '11/22/2003' => '11/28/2003',
> > );
> >
>
> This seemed like a fun exercise so I wrote the program below. It builds
> an array of eight elements, each of which is a reference to a two-element
> array containing the start and end dat
; $month++;
> my $beginyear = &ParseDate("$year/01/01");
> my $today = &ParseDate("today");
> my $firsttues = &ParseDate("$year/01/07");
> my $endyear = &ParseDate("$year/12/31");
>
>
quot;);
my $today = &ParseDate("today");
my $firsttues = &ParseDate("$year/01/07");
my $endyear = &ParseDate("$year/12/31");
#print "$beginyear $endyear\n";
#Build an array of every Tuesday in the current year
1 - 100 of 178 matches
Mail list logo