Re: dates

2006-10-10 Thread John W. Krahn
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

Re: dates

2006-10-10 Thread Rob Dixon
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\

RE: dates

2006-10-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
The same you your doing $year, $mon, $mday use %02d which tells sprintf to add leading zeros as need to keep the size correct. So \_$hour\:$min\:$sec becomes \_%02d\:%02d\:%02d and you add the $hour, $min and $sec after the $mday. If you have any problems or questions, please let

RE: Dates again.

2005-12-05 Thread Rafael Morales
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

Re: Re: Dates again.

2005-12-05 Thread Beau E. Cox
Hi vmalik - At 2005-12-05, 07:09:51 you wrote: >I am assuming that localtime() returns the time in unix file format (number of >seconds since 12:00 AM on January 01, 1970). Why don't you convert 72 days to >seconds and subtract that number from the output of localtime()? No. time() returns epo

RE: Dates again.

2005-12-05 Thread Timothy Johnson
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

Re: Dates again.

2005-12-05 Thread vmalik
I am assuming that localtime() returns the time in unix file format (number of seconds since 12:00 AM on January 01, 1970). Why don't you convert 72 days to seconds and subtract that number from the output of localtime()? For example, 72 days = 72 x 3600 x 24 seconds = 6220800 seconds So, try:

Re: Dates

2005-11-04 Thread Jeff 'japhy' Pinyan
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,

RE: Dates

2005-11-04 Thread Timothy Johnson
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

Re: Dates

2005-01-07 Thread Scott R. Godin
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

Re: Dates

2005-01-06 Thread Owen Cook
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.

Re: Dates

2005-01-06 Thread Jeff Eggen
>>> 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

Re: Dates

2005-01-06 Thread Markus Mayr
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

Re: Dates are killing me..

2004-07-07 Thread Jeff 'japhy' Pinyan
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*

Re: Dates are killing me..

2004-07-07 Thread Chris Charley
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

Re: Dates are killing me..

2004-07-07 Thread Chris Puccio
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 > > find one to do > > what I need. > > > > I have

RE: Dates are killing me..

2004-07-07 Thread Bakken, Luke
> 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

Re: Dates are killing me..

2004-07-07 Thread Johan Viklund
Hi Use the following methods from the Date::Calc module from CPAN: Week_of_Year: ($week,$year) = Week_of_Year($year,$month,$day); Monday_of_Week: ($year,$month,$day) = Monday_of_Week($week,$year); Add_Delta_Days: ($year,$month,$day) = Add_Delta_Days($year,$month,$day, $Dd); Shouldn't be t

Re: Dates Perl & SQL7

2002-02-20 Thread mike
On Wed, 2002-02-20 at 11:26, Mason, Andrew wrote: > This is a concept question rather than a code question. > > I have a script which produces a simple report on some simple disk space > stats for servers I work with. > I thought it would be useful to put this information into a database on > a d

RE: Dates in file or directory names ?

2002-02-18 Thread Dave Cross
On Sat, 02 Feb 2002 17:11:12 +, Timothy Johnson wrote: > -Original Message- > > From: Dave Cross > > To: [EMAIL PROTECTED] > > Sent: 2/2/02 1:01 AM > > Subject: Re: Dates in file or directory names ? > > > > On Thu, 31 Jan 2002 21:20:16 +

RE: Dates in file or directory names ?

2002-02-02 Thread Timothy Johnson
Or you can just use localtime(); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); my $date = ($year + 1900).($mon + 1).$mday; mkdir($date); -Original Message- From: Dave Cross To: [EMAIL PROTECTED] Sent: 2/2/02 1:01 AM Subject: Re: Dates in file or directory names

Re: Dates in file or directory names ?

2002-02-02 Thread Dave Cross
On Thu, 31 Jan 2002 21:20:16 +, Mark Richmond wrote: > Ok, so I'm confused > What I want to do is create a directory where the name is the current > date say mkdir(2002131) > What Can't figure out is how to build the date string. I'm sure I'm > just missing something. > Any thoughts. [can yo

RE: Dates

2002-02-01 Thread Timothy Johnson
Try this: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time -86400); #86400 seconds in a day print join "-",(($mon + 1),$mday,($year + 1900)); BTW, that's an interesting quote. If you don't mind my asking, who is Lucio Anneo Séneca? -Original Message- From: Argeni

RE: Dates

2002-02-01 Thread Nikola Janceski
use Date::Calc module; man Date::Calc (if it's installed). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 2:35 PM To: [EMAIL PROTECTED] Subject: Dates this statement ($sec,$min,$hour,$mon,$year,$wday,$yday,$isdst) = localtime(); i

RE: Dates in file or directory names ?

2002-01-31 Thread Wagner-David
Title: Blank     use somehting like: my ($mday, $mon, $year) = (localtime(time))[3..5];    # pull day,month, year only$year += 1900; # want 4 digit date$mon++;   # need

RE: Dates

2001-09-03 Thread Govinderjit Dhinsa
> I want to print a weekly transaction statement using perl. > It should ask the user to enter the start date and the end date > e.g:$start_date = 30/08/01(dd/mm/yy) > > $end_date = 05/09/01 > This information will filter through a transactions file to print out the > statement within

RE: Dates subtraction - one more simplification

2001-07-22 Thread Steve Howard
further manipulations of system dates to get there. Steve H. -Original Message- From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 22, 2001 9:37 AM To: Steve Howard Cc: Ackim Chisha; [EMAIL PROTECTED] Subject: RE: Dates subtraction On Jul 22, Stev

RE: Dates subtraction

2001-07-22 Thread Jeff 'japhy/Marillion' Pinyan
On Jul 22, Steve Howard said: >Have you installed and DATE::CALC. If so you would do something like >this: > >my $dd = Delta_Days(@th{year, mon, mday}, @expiatory); I far prefer the simpler (and standard-module) approach of the Time::Local module. This module is a tool you should get to know we

RE: Dates subtraction

2001-07-22 Thread Steve Howard
Have you installed and DATE::CALC. If so you would do something like this: # use date calc and get the current time into a hash: use Date::Calc qw(:all); my %th; @th{qw(sec min hour mday mon year wday yday isdst)} = localtime(time); $th{mon}++; $th{year} += 1900; #define the expiatory date