F.,

In article <[EMAIL PROTECTED] (F.H)>, F.H wrote:
>does anyone know how to convert a date from mmddyy to mmddyyyy?
>so 010201 becomes 01022001

Sure thing!

---- begin demo code
#!/usr/bin/perl -w

# Obtain month, month day, and year values from localtime()
($mon, $mday, $year) = (localtime(time))[4,3,5];

# Add 1 to month value, as month counts begin at 0, rather
# than 1, and we humans are used to January being month 1,
# February month 2, etc.
$mon++;

# If $mon is a single digit number, pad it with a leading
# zero, such that we get the MM in 'MMDDYYYY'.
$mon = '0' . $mon if ( length($mon) < 2 );

# If $mday is a single digit number, pad it to get 'DD'.
$mday = '0' . $mday if ( length($mday) < 2);

# $year is actually the number of years since 1900, so we
# add 1900 to it to get 'YYYY'
$year += 1900;

# Use string concatenation operator to stick 'em all together.
$date_string = $mon . $mday . $year;

# Show off our brilliance.
print "Today's date in MMDDYYYY format: $date_string\n";
---- end demo code

Perhaps a bit more than you asked for, but there you go.
Hope it helped.

John
-- 
               John Fox <[EMAIL PROTECTED]>
    System Administrator, InfoStructure, Ashland OR USA
  ---------------------------------------------------------
"What is loved endures.  And Babylon 5 ... Babylon 5 endures."
              --Delenn, "Rising Stars", Babylon 5

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to