| Trevor Gryffyn 2004-05-13, 12:35 pm |
| Lots of ways to skin this particular cat.. Here's one way I'd do it
(broken out a bit so you can follow the flow):
$date =3D "1965-12-25";
List($year,$month,$day) =3D explode("-",$date);
$monthtext =3D date("M",mktime(0,0,0,$month,date("d"),date("Y")));
$fixeddate =3D "$day-$monthtext-$year";
You're right though, mktime doesn't like dates prior to 1/1/1970 (at
least on this Windows system) so I'd manipulate it in pieces. If all
you need to do is translate the "12" into a "Dec" then just pull the
month out and pick any day and year. This will work fine unless you're
trying to get "day of the w ".
-TG
> -----Original Message-----
> From: Sudeep Zamudra [mailto:sudeep_zamudra@yahoo.com]=20
> Sent: Thursday, May 13, 2004 4:48 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Date format
>=20
>=20
> Hi everyone,
> =20
> I want to convert a date 1965-12-25 into the format: 25-Dec-1965.
> When i use mktime it works fine for any date after the year=20
> 1970. It doesn't work for any date before 1970. Help please.=20
> Is there any function that shows the date in the above=20
> required format.
>=20
> =09
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Movies - Buy advance tickets for 'Shrek 2'=20
>=20
|