RE: [PHP-WIN] Date format
| From: | Gryffyn, Trevor | Date: | Thu, 13 May 2004 14:10:14 +0000 |
| Subject: | RE: [PHP-WIN] Date format | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-23698@lists.php.net to get a copy of this message | ||
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 = "1965-12-25";
List($year,$month,$day) = explode("-",$date);
$monthtext = date("M",mktime(0,0,0,$month,date("d"),date("Y")));
$fixeddate = "$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 week".
-TG
> -----Original Message-----
> From: Sudeep Zamudra [mailto:sudeep_zamudra@yahoo.com]
> Sent: Thursday, May 13, 2004 4:48 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Date format
>
>
> Hi everyone,
>
> 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
> 1970. It doesn't work for any date before 1970. Help please.
> Is there any function that shows the date in the above
> required format.
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Movies - Buy advance tickets for 'Shrek 2'
>