Re: Regex for date format

2018-06-29 Thread Mike Martin
Worked perfectly thanks, uri, and same technique works perfectly in postgresql regexp_replace for info On 29 June 2018 at 16:18, Mike Martin wrote: > Thanks > > > On Fri, 29 Jun 2018, 15:48 Uri Guttman, wrote: > >> On 06/29/2018 10:41 AM, Mike Martin wrote: >> >> sorry >> -mm-dd

Re: Regex for date format

2018-06-29 Thread Mike Martin
Thanks On Fri, 29 Jun 2018, 15:48 Uri Guttman, wrote: > On 06/29/2018 10:41 AM, Mike Martin wrote: > > sorry > -mm-dd hh:mm:ss.dd > eg: > 2018-01-01 12-45-10-456789 to > 2018-01-01 12:45:10.456789 > > > > please reply to the list and not to me! > > then why did you want lookbehind? this

Re: Regex for date format

2018-06-29 Thread Uri Guttman
On 06/29/2018 10:41 AM, Mike Martin wrote: sorry -mm-dd hh:mm:ss.dd eg: 2018-01-01 12-45-10-456789 to 2018-01-01 12:45:10.456789 please reply to the list and not to me! then why did you want lookbehind? this is very easy if you just grab the time parts and reassemble them as you

Re: Regex for date format

2018-06-29 Thread Uri Guttman
On 06/29/2018 09:32 AM, Mike Martin wrote: Hi I am trying to convert a string of the format 2018-01-01 16-45-21-654278 to a proper timestamp string so basically I want to replace all -  after the date part i am not sure what you are trying to do. show the after text that you want. a proper

Regex for date format

2018-06-29 Thread Mike Martin
Hi I am trying to convert a string of the format 2018-01-01 16-45-21-654278 to a proper timestamp string so basically I want to replace all - after the date part I am getting a bit stuck, lookbehind doesnt seem to work as it includes the lookbehind on every occurence last attempt is s/(?<=

Re: Changing date format using carpout

2017-03-26 Thread X Dungeness
The rest of it: use Time::Piece; use CGI::Carp (carpout); { local *CGI::Carp::stamp = sub {... }; open( my $log, ">>", "/path/to/error.log") or die $!; carpout($log); carp("foo happened"); # close($log) } carp("foo again but with module's timestamp"); On Sun, Mar 26, 2017 at 3:04

Re: Changing date format using carpout

2017-03-26 Thread X Dungeness
Shawn may have a different take but I think the "local" is misplaced and goes out of scope when the call's made. Here's a potential workaround: out of scope On Sun, Mar 26, 2017 at 2:02 PM, SSC_perl wrote: >> On Mar 26, 2017, at 1:15 PM, Shawn H Corey

Re: Changing date format using carpout

2017-03-26 Thread SSC_perl
> On Mar 26, 2017, at 1:15 PM, Shawn H Corey wrote: > > it would mean replacing the subroutine after the module was loaded. Thanks, Shawn, but I can’t get that to work. Reading perldoc Core gives me the impression that I’d need to call the new sub, not the

Re: Changing date format using carpout

2017-03-26 Thread Shawn H Corey
On Sun, 26 Mar 2017 11:28:44 -0700 SSC_perl wrote: > > On Mar 25, 2017, at 8:58 PM, Jim Gibson > > wrote: > > > > You could also try overriding the supplied function of the imported > > module with your own version (not sure exactly how that is

Re: Changing date format using carpout

2017-03-26 Thread SSC_perl
> On Mar 26, 2017, at 1:20 AM, X Dungeness wrote: > > but you could post-process the logfile in an END {} block I wouldn't have thought of that. Thanks! This now gives me a cleaner log to scan — streamlining the timestamp and adding a blank line between

Re: Changing date format using carpout

2017-03-26 Thread SSC_perl
> On Mar 25, 2017, at 8:58 PM, Jim Gibson wrote: > > You could also try overriding the supplied function of the imported module > with your own version (not sure exactly how that is done). Hmm… me neither, but it’s a good idea. I’ll contact the maintainer of

Re: Changing date format using carpout

2017-03-26 Thread X Dungeness
ut); > open(_STDERR,'>'); close STDERR; > open (my $log, '>>', 'logs/error.log') or warn("Couldn't open > error.log: $! \n"); > carpout($log); > close ($log); > } > > However, I would like to change the date form

Re: Changing date format using carpout

2017-03-25 Thread Jim Gibson
ose STDERR; > open (my $log, '>>', 'logs/error.log') or warn("Couldn't open > error.log: $! \n"); > carpout($log); > close ($log); > } > > However, I would like to change the date format. I’m not wild about > seeing the the full timestamp

Changing date format using carpout

2017-03-25 Thread SSC_perl
;); carpout($log); close ($log); } However, I would like to change the date format. I’m not wild about seeing the the full timestamp on every line: [Sat Mar 25 08:05:58 2017] Is there a way I can format that to my liking? I see there's a ‘noTimestamp’ opt

Re: Convert any date format to ISO

2013-07-28 Thread Michael Brader
On 07/26/2013 06:10 AM, Charles DeRykus wrote: On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader mbra...@internode.com.au mailto:mbra...@internode.com.au wrote: [...] There are at least 2 modules that can definitely do the job for you, Date::Manip::Date and DateTime (with

Re: Convert any date format to ISO

2013-07-27 Thread Charles DeRykus
On Fri, Jul 26, 2013 at 4:45 AM, Perl Beginners beginners@perl.org wrote: On 07/25/2013 04:40 PM, Charles DeRykus wrote: On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader mbra...@internode.com.au mailto:mbra...@internode.com.**aumbra...@internode.com.au wrote: On 07/25/2013 10:14

Re: Convert any date format to ISO

2013-07-25 Thread Michael Brader
On 07/25/2013 03:26 PM, Jim Gibson wrote: You don't need a module to recognize a date in the form DD-MM- and change it into the form -MM-DD (untested): if( $date =~ /^(\d\d)-(\d\d)-(\d\d\d\d)$/ ) { $date = $3-$2-$1; }else{ # try other conversions } Jim's right, but be aware

Re: Convert any date format to ISO

2013-07-25 Thread Charles DeRykus
On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader mbra...@internode.com.auwrote: On 07/25/2013 10:14 AM, mimic...@gmail.com wrote: I was trying to use Date::Simple to convert date from DD-MM- to ISO standard -MM-DD, but it produced error below because it returned undef when the

Re: Convert any date format to ISO

2013-07-24 Thread mimic...@gmail.com
I was trying to use Date::Simple to convert date from DD-MM- to ISO standard -MM-DD, but it produced error below because it returned undef when the date passed is not ISO standard. $ perl -e 'use Date::Simple (:all);$date = Date::Simple-new(29-01-1972); $x = $date-as_iso; print $x\n

Re: Convert any date format to ISO

2013-07-24 Thread Michael Brader
On 07/25/2013 10:14 AM, mimic...@gmail.com wrote: I was trying to use Date::Simple to convert date from DD-MM- to ISO standard -MM-DD, but it produced error below because it returned undef when the date passed is not ISO standard. Yeah on quick scan of the perldoc it looks like

Re: Convert any date format to ISO

2013-07-24 Thread Jim Gibson
On Jul 24, 2013, at 5:44 PM, mimic...@gmail.com wrote: I was trying to use Date::Simple to convert date from DD-MM- to ISO standard -MM-DD, but it produced error below because it returned undef when the date passed is not ISO standard. You don't need a module to recognize a date

date format search insdie the files

2008-11-29 Thread Sureshkumar M (HCL Financial Services)
Hi All, I try to search the string which has the date format inside the file, But i am not able to get the desired files. Pls help me on this.. C)/tmp/sms/perl$ cat a1 115-06-1979 10-11-81 20-NOV-2008 05-07-1981 welcome 15-10-2008 12-03-20009 (C)/tmp/sms

Re: date format search insdie the files

2008-11-29 Thread David Schmidt
; On Sat, Nov 29, 2008 at 10:11 AM, Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED] wrote: Hi All, I try to search the string which has the date format inside the file, But i am not able to get the desired files. Pls help me on this.. C)/tmp/sms/perl$ cat a1 115-06

RE: date format search insdie the files

2008-11-29 Thread Sureshkumar M (HCL Financial Services)
-20009 15-10-2008 (C)/tmp/d$ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Schmidt Sent: Saturday, November 29, 2008 3:12 PM To: Sureshkumar M (HCL Financial Services); beginners@perl.org Subject: Re: date format search insdie

RE: date format search insdie the files

2008-11-29 Thread Sureshkumar M (HCL Financial Services)
Hi all , Can someone help me on this From: Sureshkumar M (HCL Financial Services) Sent: Saturday, November 29, 2008 4:21 PM To: 'David Schmidt' Cc: beginners@perl.org Subject: RE: date format search insdie the files Hi David, Thanks

Re: date format search insdie the files

2008-11-29 Thread Dr.Ruud
Sureshkumar M (HCL Financial Services) schreef: #/usr/bin/perl open(DATA,a1)||dieUnable to open the file; while(DATA) { if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/) { print $_; } } close(DATA); exit 0; #!/usr/bin/perl use strict; use warnings; my $in_name = data.in; { open my

RE: date format search insdie the files

2008-11-29 Thread Sureshkumar M (HCL Financial Services)
5:30 PM To: beginners@perl.org Subject: Re: date format search insdie the files Sureshkumar M (HCL Financial Services) schreef: #/usr/bin/perl open(DATA,a1)||dieUnable to open the file; while(DATA) { if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/) { print $_; } } close(DATA); exit 0; #!/usr

Re: date format search insdie the files

2008-11-29 Thread Dr.Ruud
Sureshkumar M (HCL Financial Services) schreef: Can you explain me this part how it's works? (?:\d{2}|\w{3}) ?: what this will do? Read perlre (and find out what (?:) means). And also, the output is like below (C)/tmp/d$ perl 1 10-11-81 20-NOV-2008 05-07-1981 15-110-2008

Re: date format search insdie the files

2008-11-29 Thread Dr.Ruud
Sureshkumar M (HCL Financial Services) schreef: Can someone help me on this Impossible. -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Fwd: Date format search in the file

2008-11-24 Thread Dermot
2008/11/22 sftriman [EMAIL PROTECTED]: On Nov 22, 6:16 am, [EMAIL PROTECTED] (Dermot) wrote: 2008/11/22 Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED]: I could be wrong but I don't think \w will not match a hypen - so the test will fail. This works for me: if

Date format search in the file

2008-11-22 Thread Sureshkumar M (HCL Financial Services)
Hi All, I want to find the string which are having the date inside the file. Please help me how do I match it,below is my program and it's not returning anything. #!/usr/bin/perl open(DATA,i)||die Unable to open the file; while(DATA) { if($_=~/(\d{2})([\W])\1\2\1]/) {

Re: Date format search in the file

2008-11-22 Thread Dermot
2008/11/22 Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED]: Hi All, Hi #!/usr/bin/perl # Always use these, particularly when things aren't working as expected. use strict; use warnings; open(DATA,i)||die Unable to open the file; while(DATA) { if($_=~/(\d{2})([\W])\1\2\1]/)

Re: Date format search in the file

2008-11-22 Thread John W. Krahn
Sureshkumar M (HCL Financial Services) wrote: Hi All, Hello, I want to find the string which are having the date inside the file. Please help me how do I match it,below is my program and it's not returning anything. #!/usr/bin/perl use warnings; use strict; open(DATA,i)||die Unable to

Re: Date format search in the file

2008-11-22 Thread John W. Krahn
Dermot wrote: 2008/11/22 Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED]: #!/usr/bin/perl # Always use these, particularly when things aren't working as expected. use strict; use warnings; open(DATA,i)||die Unable to open the file; while(DATA) { if($_=~/(\d{2})([\W])\1\2\1]/)

Re: Date format search in the file

2008-11-22 Thread sftriman
On Nov 22, 6:16 am, [EMAIL PROTECTED] (Dermot) wrote: 2008/11/22 Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED]: Hi All, Hi #!/usr/bin/perl # Always use these, particularly when things aren't working as expected. use strict; use warnings; open(DATA,i)||die Unable to

WIN32::OLE problem while reading the date format

2006-02-08 Thread swayam panda
; } } But the same code is working if in the excel file (which i am reading ) i am using date format as 06\02\2006 ( back ward slash) Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: WIN32::OLE problem while reading the date format

2006-02-08 Thread Alfred Vahau
HARDWAREVERSION) { print FILE # . $sheet-Range('A'.$i)-{'Value'} . :\t .$sheet-Range('B'.$i)-{'Value'}. \n; } } But the same code is working if in the excel file (which i am reading ) i am using date format as 06\02\2006 ( back ward slash) Thanks -- To unsubscribe, e-mail: [EMAIL

Newbie needs help changing date format

2004-08-26 Thread John Bruin
Hi I have a list of dates that have been converted to epoch seconds, processed and then converted back to a string (using timelocal). The resulting date format is:- Wed Mar 16 22:10:16 2004 What is the easiest way to convert this format (or epoch seconds) to 16-Mar-2004 22:10 - preferrably

Re: Newbie needs help changing date format

2004-08-26 Thread Wiggins d Anconia
Hi I have a list of dates that have been converted to epoch seconds, processed and then converted back to a string (using timelocal). The resulting date format is:- Wed Mar 16 22:10:16 2004 What is the easiest way to convert this format (or epoch seconds) to 16-Mar-2004 22:10

Re: Newbie needs help changing date format

2004-08-26 Thread Gunnar Hjalmarsson
John Bruin wrote: I have a list of dates that have been converted to epoch seconds, processed and then converted back to a string (using timelocal). The resulting date format is:- Wed Mar 16 22:10:16 2004 What is the easiest way to convert this format (or epoch seconds) to 16-Mar-2004 22:10

RE: Newbie needs help changing date format

2004-08-26 Thread John Bruin
9:35 a.m. To: John Bruin; [EMAIL PROTECTED] Subject: Re: Newbie needs help changing date format Hi I have a list of dates that have been converted to epoch seconds, processed and then converted back to a string (using timelocal). The resulting date format is:- Wed Mar 16 22:10:16 2004

Re: date format

2004-08-17 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. perldoc -f localtime describes very clearly how you get a two digit year. It's advisable to study the

date format

2004-08-16 Thread DBSMITH
All, I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. Should I just use Posix with strftime or is there a quicker way w/out having to load the Posix module? also, why I

RE: date format

2004-08-16 Thread Bob Showalter
[EMAIL PROTECTED] wrote: All, I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. Should I just use Posix with strftime or is there a quicker way w/out having to

Re: date format

2004-08-16 Thread Chris Devers
On Mon, 16 Aug 2004 [EMAIL PROTECTED] wrote: I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. Should I just use Posix with strftime or is there a quicker way w/out having to

RE: date format

2004-08-16 Thread Bob Showalter
Bob Showalter wrote: ($year + 1900) % 100 Actually just $year % 100 is valid. The former makes it clearer what you're doing, if you're into that :~) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: date format

2004-08-16 Thread Flemming Greve Skovengaard
[EMAIL PROTECTED] wrote: All, I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. Should I just use Posix with strftime or is there a quicker way w/out having to load the

RE: date format

2004-08-16 Thread DBSMITH
], [EMAIL PROTECTED] cc: Subject:RE: date format Bob Showalter wrote: ($year + 1900) % 100 Actually just $year % 100 is valid. The former makes it clearer what you're doing, if you're into that :~)

RE: date format

2004-08-16 Thread Bob Showalter
Flemming Greve Skovengaard wrote: printf (%02d/%02d/%02d\n, $month + 1, $day, $year - 100); # Only works when $year 1999. And when $year = 2099 :~) Stick to $year % 100; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: date format

2004-08-16 Thread Flemming Greve Skovengaard
Bob Showalter wrote: Flemming Greve Skovengaard wrote: printf (%02d/%02d/%02d\n, $month + 1, $day, $year - 100); # Only works when $year 1999. And when $year = 2099 :~) Stick to $year % 100; Yes, you are correct. Your solution is fool proof. -- Flemming Greve Skovengaard FAITH, n.

Re: date format

2004-08-16 Thread DBSMITH
I have this value, from the date format solution emails, in a subroutine and I want to pass it to a if clause, how would I go about this? Can I assign a literal such as sub datemanip { my ( $month, $day, $year) = (localtime)[4,3,5]; my $foodate = printf (%02d/%02d/%02d\n

Re: date format

2004-08-16 Thread Chris Devers
On Mon, 16 Aug 2004 [EMAIL PROTECTED] wrote: sub datemanip A name like that screams a need for the Date::Manip CPAN module: http://search.cpan.org/~sbeck/DateManip-5.42a/Manip.pod Look over the docs for that module, see if you can't use it to do what you need to do, and let the list know if you

Re: date format

2004-08-16 Thread Flemming Greve Skovengaard
[EMAIL PROTECTED] wrote: I have this value, from the date format solution emails, in a subroutine and I want to pass it to a if clause, how would I go about this? Can I assign a literal such as sub datemanip { my ( $month, $day, $year) = (localtime)[4,3,5]; my $foodate

date format using localtime()

2004-03-12 Thread Jeff Westman
Is there a way in perl to get the month/day/year using localtime WITHOUT using 'use POSIX qw(strftime)' or a system date call. Something using slices, maybe something like: print scalar ((localtime(time))[4,3,7]) expecting the result to be 03122004. Trivial question, thanks in advance.

Re: date format using localtime()

2004-03-12 Thread Steve Mayer
Jeff, Check out http://www.users.voicenet.com/~corr/macsupt/macperl/localtime.html Steve On Fri, Mar 12, 2004 at 01:38:28PM -0800, Jeff Westman wrote: Is there a way in perl to get the month/day/year using localtime WITHOUT using 'use POSIX qw(strftime)' or a system date call.

Re: date format using localtime()

2004-03-12 Thread Owen Cook
On Fri, 12 Mar 2004, Jeff Westman wrote: Is there a way in perl to get the month/day/year using localtime WITHOUT using 'use POSIX qw(strftime)' or a system date call. Something using slices, maybe something like: print scalar ((localtime(time))[4,3,7]) expecting the result to

Date format again

2002-03-03 Thread Troy May
Hello, this guy finally emailed his script to me. The problem he is having is with $year. Here's the dating part of the code: --- $date = `/bin/date`; chop($date); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; $thisday =

Re: Date format again

2002-03-03 Thread fliptop
Troy May wrote: Hello, this guy finally emailed his script to me. The problem he is having is with $year. Here's the dating part of the code: --- $date = `/bin/date`; chop($date); has this guy considered using Date::Calc?

Re: Date format again

2002-03-03 Thread Marcelo E. Magallon
[ Don't Cc: me, I read this mailing list, thank you ] Troy May [EMAIL PROTECTED] writes: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; $thisday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime) [6]]; $s = (localtime)[0]; $m = (localtime)[1]; $m = ($m + 35) ; Is

Re: Date format again

2002-03-03 Thread Alfred Wheeler
- From: Troy May [EMAIL PROTECTED] To: Beginners CGI List [EMAIL PROTECTED] Sent: Sunday, March 03, 2002 12:52 AM Subject: Date format again Hello, this guy finally emailed his script to me. The problem he is having is with $year. Here's the dating part of the code

Converting numbers into date format

2001-12-04 Thread Sandeep Pathare
I am a beginner of Perl. How do I convert and print the following strings into a date format so that either the date is returned or date not valid is printed. Input data is: 792910171010163200 552910171010163200 552913171010163200 552910171010163200 552909171010163200 552909171010163200

Re: Converting numbers into date format

2001-12-04 Thread nafiseh saberi
www.iraninfocenter.net www.sorna.net ___ - Original Message - From: Sandeep Pathare [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 04, 2001 08:12 AM Subject: Converting numbers into date format I am a beginner of Perl. How do I convert and print the following

Re: Converting numbers into date format

2001-12-04 Thread Joel Divekar
into date format I am a beginner of Perl. How do I convert and print the following strings into a date format so that either the date is returned or date not valid is printed. Input data is: 792910171010163200 552910171010163200 552913171010163200 552910171010163200

Re: Converting numbers into date format

2001-12-04 Thread John W. Krahn
Sandeep Pathare wrote: I am a beginner of Perl. How do I convert and print the following strings into a date format so that either the date is returned or date not valid is printed. Input data is: 792910171010163200 552910171010163200 552913171010163200 552910171010163200

Re: Converting numbers into date format

2001-12-04 Thread John W. Krahn
John W. Krahn wrote: Sandeep Pathare wrote: I am a beginner of Perl. How do I convert and print the following strings into a date format so that either the date is returned or date not valid is printed. Input data is: 792910171010163200 552910171010163200 552913171010163200

Help on Date Format

2001-04-24 Thread Arante, Susan
Could someone tell me why this is happening? When I use this command, it used to give me 20010405.doc (mmdd.doc), now it's giving me 2001 4 5.doc - I'm losing the leading zeros. Command is on Perl 5 - printf(\%s%02s%02s.doc,$year,$month,$day). Thanks.

Re: Help on Date Format

2001-04-24 Thread Casey West
On Tue, Apr 24, 2001 at 11:00:40AM -0500, Arante, Susan wrote: : Could someone tell me why this is happening? When I use this command, it : used to give me 20010405.doc (mmdd.doc), now it's giving me 2001 4 5.doc : - I'm losing the leading zeros. : Command is on Perl 5 -

Re: Help on Date Format

2001-04-24 Thread Kevin Meltzer
Hi Susan, I get what you expect: perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)'; 20010405.doc Personally, I like POSIX.pm for dates. # perl -MPOSIX -wle 'print strftime(%Y%m%d, localtime) . .doc'; 20010424.doc 'perldoc POSIX' to learn more (look for strftime). Cheers, Kevin

RE: Help on Date Format

2001-04-24 Thread Arante, Susan
: Help on Date Format Hi Susan, I get what you expect: perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)'; 20010405.doc Personally, I like POSIX.pm for dates. # perl -MPOSIX -wle 'print strftime(%Y%m%d, localtime) . .doc'; 20010424.doc 'perldoc POSIX' to learn more (look for strftime

Re: Help on Date Format

2001-04-24 Thread John Joseph Trammell
On Tue, Apr 24, 2001 at 01:09:13PM -0400, Kevin Meltzer wrote: Hi Susan, I get what you expect: perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)'; 20010405.doc [snip] Well I'll be damned. [ ~ ] perl -e 'printf %04s\n, 1' 0001 [ ~ ] perl -e 'printf %04s\n, 1' 0001 [ ~ ]

Re: Help on Date Format

2001-04-24 Thread Kevin Meltzer
In this case, it wont really matter. Since 1 and 1 is essentially the same. If you were actually using a signed integer (in decimal), then you would see the difference: From perldoc -f sprintf: %s a string %d a signed integer, in decimal [root@fluffhead /]# perl -e 'printf %04s\n,