? |
PHP FAQ
PHP Articles
PHP Help
Bulletin Board
PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help
C# Help
|
? |
?Transforming Dates |
Author:??(---.pool038.at101.earthlink.net)
Date:???07-03-03 19:27
Lets say i have a date in some form - "mdY" for instance - and lets pretend the value is "05302003" for May 5th 2003 . . .
how can i use php to transform that into some other form . . . say M j Y?
|
|
?Re: Transforming Dates |
Author:??(---.cpe.net.cable.roger)
Date:???07-06-03 08:22
$date = ("M j Y", $date);
hth
|
|
?Re: Transforming Dates |
Author:??(200.55.155.---)
Date:???07-07-03 12:18
I hope this example gives you some ideas. Sorry about variables they are in Spanish (I' m cuban)
$fecha_reserva = (string) $fecha_reserva;
$mois = substr($fecha_reserva,5,2);
$mjour = substr($fecha_reserva,8,2);
$annee = substr($fecha_reserva,2,2);
$fecha_reserva = $annee . $mois . $mjour;
$aujourdhui = getdate();
$mois = (string) $aujourdhui['mon'];
$mjour = (string) $aujourdhui['mday'];
$annee = (string) ( $aujourdhui['year'] - 2000 );
if ( $aujourdhui['mon'] < 10 ){ $mois = "0" . $mois; }
if ( $aujourdhui['mday'] < 10 ){ $mjour = "0" . $mjour; }
if ( $aujourdhui['year'] - 2000 < 10 ){ $annee = "0" . $annee; }
// This is an example:
$id_usuario = $annee . $mois . $mjour . $id_usuario;
|
|
|