On Sun, 06 Aug 2000 13:10:23 -0700, Nathan Wiger wrote:

>With the new date function you'll never need
>> to call
>> 
>>      sprintf("%02d/%02d/%04d", $tm[3], $tm[4]+1, $tm[5]+1900);
>>
>> since you can do
>> 
>>      date(undef,"%d/%m/%Y")
>
>True, but notice that you have to specify a format.

>> Also, why not space-pad the mday?
>
>Actually, given what I just said above - good point! This is actually a
>whole issue by itself. Here's the question: how should day/month/year
>look:
>
>   02/05/0982    # 0-padded
>   2/5/982       # not 0-padded
>
>Geez, I can really see it both ways (although I probably prefer the
>former because it's easier to work with).

You can adapt some stuff from (s)printf:

      date(undef,"%02d/%02m/%Y")        zero padded

      date(undef,"%2d/%2m/%Y")          space padded

      date(undef,"%d/%m/%Y")            not padded


We should give an option of using 4 or 2 digit years. Or 3, for the
truely bizarre... ;-)


>   $backup_suffix = join '', ((date)[0..6]);
> 
>This is why I think 0-padding is invaluable. 

I like that. Only, zero padding should not be done if an explicit format
is given, as above.

-- 
        Bart.

Reply via email to