RE: Date format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx] 
> Sent: Thursday, May 13, 2004 4:48 AM
> To: php-windows@xxxxxxxxxxxxx
> Subject:  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' 
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux