Lightning flashed, thunder crashed and [EMAIL PROTECTED] (F.H) whispered:
| Hi,
| does anyone know how to convert a date from mmddyy to mmddyyyy?
| so 010201 becomes 01022001
I've seen a couple of people respond to you using all sorts of date
manipulation routines. Even I had a hard time following them, and how they
relate to your question! They provide some good information *if* you are
generating the current date. However, I'm guessing that what you are
looking for is much more simple than what they are providing. If you have
a string that contains between four and six digits (the last two are the
year), you can do something like:
$date = "010201";
substr($date, -2, 0, '20');
print $date;
This will print "01022001". What it is doing is replacing zero characters
at the -2 offset (2 from the end) of $date with 20.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point." -Simon Cozens
UNIX, Perl, PHP, Web Consulting and Training http://www.unixlabs.net/~spp/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]