home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / perl / 7943 < prev    next >
Encoding:
Text File  |  1993-01-22  |  1.6 KB  |  45 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!cs.utexas.edu!convex!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: month in localtime?
  5. Originator: tchrist@pixel.convex.com
  6. Sender: usenet@news.eng.convex.com (news access account)
  7. Message-ID: <1993Jan22.135742.648@news.eng.convex.com>
  8. Date: Fri, 22 Jan 1993 13:57:42 GMT
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. References: <1993Jan20.205428.19963@fnbc.com>
  11. Nntp-Posting-Host: pixel.convex.com
  12. Organization: Convex Computer Corporation, Colorado Springs, CO
  13. Keywords: time,month
  14. X-Disclaimer: This message was written by a user at CONVEX Computer
  15.               Corp. The opinions expressed are those of the user and
  16.               not necessarily those of CONVEX.
  17. Lines: 26
  18.  
  19. From the keyboard of jja@fnbc.com (Joseph Alotta):
  20. :how does one get the month out in localtime?
  21. :this one's right out of the book:
  22. :
  23. :#!/usr/local/bin/perl  
  24. :($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
  25. :print "$sec,$min,$hour,$mday,mon=$mon,$year,$wday,$yday,$isdst\n";
  26. :exit;
  27. :
  28. :amy{jja}44: headline.prl
  29. :19,52,14,20,mon=0,93,3,19,0
  30. :amy{jja}45: date
  31. :Wed Jan 20 14:52:21 CST 1993
  32.  
  33.  
  34. # I make both 0 and 7 be Sunday cause some folks are confused
  35. $wname = (Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun)[$wday]; 
  36.  
  37. $mname = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon];
  38.  
  39. --tom
  40. -- 
  41.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  42.     "...this does not mean that some of us should not want, in a rather
  43.     dispassionate sort of way, to put a bullet through csh's head."
  44.         Larry Wall in <1992Aug6.221512.5963@netlabs.com>
  45.