Click here to get back home

Date and time--recommended module?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Date and time--recommended module? Mark 11-08-2006
Posted by Mark on November 8, 2006, 3:41 pm
Please log in for more thread options


Hello.

I am looking for a module to use for date and time string manipulations.
I want something that can recognize most of the various date/time strings
in common useage, perform calculations, and so on.

I have checked the FAQ but I see no recommendations there.
CPAN offers quite a few, but I don't know which is most commonly
used and recommended.

Suggestions?

Thanks
-Mark



Posted by James T. on November 8, 2006, 9:42 am
Please log in for more thread options


On Wed, 08 Nov 2006 12:41:30 -0800, Mark wrote:

> Hello.
>
> I am looking for a module to use for date and time string manipulations.
> I want something that can recognize most of the various date/time strings
> in common useage, perform calculations, and so on.
>
> I have checked the FAQ but I see no recommendations there.
> CPAN offers quite a few, but I don't know which is most commonly
> used and recommended.
>
> Suggestions?
>
> Thanks
> -Mark

I use the following code, instead of a specific module.

@now = gmtime(time);

# for YYYYMMDD format
$now_date = sprintf("%04d%02d%02d", $now[5]+1900, $now[4]+1, $now[3]);

# for YYYYMMDDhhmmss format
$now_time = sprintf("%04d%02d%02d%02d%0d%02d", $now[5]+1900, $now[4]+1, $now[3],
$now[2], $now[1], $now[0]);

If you work with/store dates this way, it makes it easy to do a lot of things
with the dates.

Hope this helps...

Posted by Gunnar Hjalmarsson on November 8, 2006, 4:01 pm
Please log in for more thread options


Mark wrote:
> I am looking for a module to use for date and time string manipulations.
> I want something that can recognize most of the various date/time strings
> in common useage, perform calculations, and so on.
>
> I have checked the FAQ but I see no recommendations there.
> CPAN offers quite a few, but I don't know which is most commonly
> used and recommended.

This article provides some guidance:
http://www.perl.com/pub/a/2003/03/13/datetime.html

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Posted by Mark on November 9, 2006, 11:31 am
Please log in for more thread options


>
> This article provides some guidance:
> http://www.perl.com/pub/a/2003/03/13/datetime.html

Thanks for the O'Reilly link. . .another helpful bookmark for my
collection!

It looks like HTTP::Date will meet most of my needs.

-Mark



Posted by John Bokma on November 8, 2006, 4:04 pm
Please log in for more thread options



> Hello.
>
> I am looking for a module to use for date and time string
> manipulations. I want something that can recognize most of the various
> date/time strings in common useage, perform calculations, and so on.
>
> I have checked the FAQ but I see no recommendations there.
> CPAN offers quite a few, but I don't know which is most commonly
> used and recommended.
>
> Suggestions?

Read this first:
<http://search.cpan.org/~sbeck/DateManip-5.44/Manip.pod#SHOULD_I_USE_DATE
%3A%3AMANIP>

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/

Similar ThreadsPosted
Date::MSAccess V 1.01 July 29, 2004, 7:15 am
problems with Date-Calc July 8, 2004, 3:09 pm
Date::Calc install September 8, 2004, 10:02 am
perl date manipulation October 21, 2004, 5:02 pm
ANNOUNCE: Date::MSAccess V 1.02 February 14, 2005, 10:44 am
Date::Simple confusion May 8, 2005, 6:10 pm
Date::Calc Problem February 9, 2006, 12:25 am
military time with Date::Calc June 9, 2005, 1:09 am
Handle multiple input date formats? September 11, 2004, 11:56 am
Trying to get HTML::Mason running, stuff out-of-date? October 6, 2004, 5:28 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap