Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 27th, 2001, 12:00 PM
Dups Dups is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 30 Dups User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Smile

Hello there!
Could anyone please suggest a way to do calculations with date and time in perl. Could you please suggest the functions related to date and time.

Thanks in advance
Dups


Reply With Quote
  #2  
Old February 27th, 2001, 01:29 PM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
Thumbs up

Depending what format of the date and time your using, using the time(); function works very well for calculating date and times. Or check into the POSIX qw(strftime) module

Mickalo

[Edited by mickalo on 02-27-2001 at 12:31 PM]
__________________

Thunder Rain Internet Publishing

Custom Programming & Database development
Providing Personal/Business
Internet Solutions that work!

Reply With Quote
  #3  
Old February 27th, 2001, 02:41 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
use POSIX qw/strftime/;

$time = strftime( "%A, %B %d, %Y", localtime(time()) );

would return the time in "Weekday, Month Day, Year" format.

[Edited by JonLed on 02-27-2001 at 02:02 PM]

Reply With Quote
  #4  
Old February 27th, 2001, 10:56 PM
Dups Dups is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 30 Dups User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
more doubts about date calculations

Hello there,
Thank u very much JohnLed and mickalo. What u suggested became very useful to me.

I would like to know whether there are more functions related to date and time. I want to find the days between 2 dates. Also I have to add the no: of days to a date and get the new date.

Could u suggest some sites which provide this information

Thank u again
Dups

Reply With Quote
  #5  
Old February 28th, 2001, 12:41 AM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
http://search.cpan.org/doc/JHI/perl...POSIX/POSIX.pod

All kinds of great stuff in the POSIX module (well beyond just date/time functions). I'm sure you can get what you're looking for by combining some of the functions in creative ways .

Reply With Quote
  #6  
Old March 1st, 2001, 11:48 PM
Dups Dups is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 30 Dups User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Hello

I found a module DateCalcLib.pm somewhere. It does all the calculations that i need . Wouln't that be good. Is that a good module?

But it is not provided by cpan. Could u please suggest from where i can get it.

Thank u
Dups

Reply With Quote
  #7  
Old March 2nd, 2001, 03:48 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
I don't know , and I'm sure it's a good module, it's just that POSIX is standard distribution with perl, so you'll more than likely have it installed already. I suggest you just figure it out.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > date and time functions in perl


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT