Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Dates with Perl

Reply
Thread Tools

Dates with Perl

 
 
Firewalker
Guest
Posts: n/a
 
      09-28-2004
Hey guys,
I am newbie to perl. I am trying to deal with dates ( such trying to find
what the date would be after month). Is therea function or date class( I am
a java programmer, I couldnt find the right word instead of class) to do the
job?
Thanks for any help.


 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      09-28-2004
Firewalker wrote:

> Hey guys,


Don't post separate messages to separate newsgroups.
You're supposed to post a single message to multiple groups
simultaneously. It's called cross-posting. Someone has
already answered in the alt.perl newsgroup.

Post to comp.lang.perl.misc instead of here (comp.lang.perl).
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      09-28-2004
Firewalker wrote:
> I am newbie to perl. I am trying to deal with dates ( such trying to
> find what the date would be after month). Is therea function or date
> class [...]


In spite your name you may want to put on your fireproof suit.

What happened when you asked Google (this question is asked often), asked
the FAQ (this question is asked often; although personally I find the FAQ
answer somewhat lacking), or asked CPAN (there are many modules to deal with
dates: http://search.cpan.org/search?query=date&mode=module)?

If your question would have been which module to use: typically people
recommend Date::Calc or Date::Manip the most.

jue


 
Reply With Quote
 
dink
Guest
Posts: n/a
 
      10-01-2004
"Firewalker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hey guys,
> I am newbie to perl. I am trying to deal with dates ( such trying to find
> what the date would be after month). Is therea function or date class( I

am

that's easy:

use Date::Calc qw(Add_Delta_Days);

# get current date
@l_date = sub {($_[5]+1900, $_[4]+1, $_[3])}->(localtime);

# or set some other date
@l_date = (2004, 5, ;

# add a week to @l_date
@l_date_week_after = Add_Delta_Days(@l_date, +7);

# subtract a week from @l_date
@l_date_week_before = Add_Delta_Days(@l_date, -7);

# print the stuff
printf ("l_date=%04d-%02d-%02d l_date_week_after=%04d-%02d-%02d
l_date_week_before=%04d-%02d-%02d\n", @l_date, @l_date_week_after,
@l_date_week_before);

but if you wannna know a date after a month you have to write a function
which handles year/month rollovers and uses Add_Delta_Days accordingly

--
dink.
Toyota MR2 Club Poland
www.mr2.pl



 
Reply With Quote
 
lesley_b_linux@yahoo.co.yuk
Guest
Posts: n/a
 
      10-21-2004
"Firewalker" <(E-Mail Removed)> writes:

> Hey guys,
> I am newbie to perl. I am trying to deal with dates ( such trying to find
> what the date would be after month). Is therea function or date class( I am
> a java programmer, I couldnt find the right word instead of class) to do the
> job?
> Thanks for any help.


Welcome to comp.lang.perl

This newsgroup, despite it's level of activity, has been declared defunct in
Google
and in http://www.perldoc.com/perl5.8.4/pod...ost-questions-

You might want to familiarise yourself with the posting guidelines for
comp.lang.perl.misc at http://mail.augustmail.com/~tadmc/cl...uidelines.text
before posting there.

I note from your headers that you are a Windows user or at least you used MS
Outlook to post here. If you were using a Linux install of Perl then I would
say use:

man perl
man perlfaq
perldoc perldoc
perldoc perl

but I don't have a clue what documentation you'd get with Perl on Windows. (I
have heard that ActiveState Perl has a help button somewhere on the Start
button menu but can't verify this at all.)

You might want to browse http://www.perl.org, http://www.perldoc.com/, http://www.perl.com
and http://www.cpan.org for modules (the nearest Perl has to Java classes)

Also put Perl into a google search then trawl through the webpages you find
there and the group archives for answers to any questions you might have that
might have been answered already.

If you want to download modules from CPAN then check your perl documentation
to see if 'perl -MCPAN -e shell' will work or look for something similar. It
will do the installation work for you.

HTH

Lesley
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RFC-822 dates into Ruby dates kellygreer1 Ruby 1 06-08-2008 10:59 PM
Need to use dates earlier than 1900 (Time library says out of range for dates < 1900) me@benjaminarai.com Ruby 1 07-17-2007 02:25 PM
FAQ Dates; Opera Dates. Dr J R Stockton Javascript 0 06-18-2007 03:51 PM
Dates dates dates dates... SQL and ASP.NET David Lozzi ASP .Net 1 09-30-2005 02:18 PM
Dates! Dates! Dates! PW ASP General 4 08-09-2004 04:42 PM



Advertisments