
March 3rd, 2000, 08:39 AM
|
|
Junior Member
|
|
Join Date: Mar 2000
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I thought about two ways to do this:
The first is this:
$standard_date = ereg_replace( "(..).(..).(....)", "2-1-3", $belgium_date );
This is more "elegant" and does all in a single instruction, but do not work if the user insert dates with a non-fixed format (i mean,the date 02/01/1999 can be written also 2/1/99).
Instead you can use:
list( $day, $month, $year ) = split( '/', $belgium_date );
$standard_date = $year + "-" + $month + "-" + $day;
this gives you also the three variables that you can compose as you like. Also this will work even if the user enters dates using a non-fixed format.
I have not tested it, but i'm pretty sure they're right.
Hope it helps,
=KL=
|