[PHP] Date formating
Hi, I have a string in this format: 2003-02-15 13:19:02 I want to display it in a more readable format like Staurday, 11 Februardy, 2003, 13:19:02. How can I achieve that. I tried date() function but could not get what I wanted. -Dhaval _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date formating
On Saturday 15 February 2003 16:56, Dhaval Desai wrote: Hi, I have a string in this format: 2003-02-15 13:19:02 I want to display it in a more readable format like Staurday, 11 Februardy, 2003, 13:19:02. How can I achieve that. I tried date() function but could not get what I wanted. strtotime(), strftime(). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* We have met the enemy, and he is us. -- Walt Kelly */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date formating
? echo date('the format you want', strtotime('2003-02-15 13:19:02')); ? In this case 'the format you want' is 'l, d F, Y. H:i:s', but you should be able to look it up in the manual for yourself. php.net/date strtotime('2003-02-15 13:19:02') SHOULD work, converting the string to a unix time stamp, which is what date() needs to work. All this is available in the manual of course :) Justin on 15/02/03 7:56 PM, Dhaval Desai ([EMAIL PROTECTED]) wrote: Hi, I have a string in this format: 2003-02-15 13:19:02 I want to display it in a more readable format like Staurday, 11 Februardy, 2003, 13:19:02. How can I achieve that. I tried date() function but could not get what I wanted. -Dhaval _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date formating
I have a string in this format: 2003-02-15 13:19:02 I want to display it in a more readable format like Staurday, 11 Februardy, 2003, 13:19:02. How can I achieve that. I tried date() function but could not get what I wanted. The date format above is a standard mysql date/time format. If this is where you are getting that date from then your best method is probably to do the date conversion as part of your mysql query. You'll need to consult the mysql manual (chapter 6.something from memory) where it talks about stuff useful in select statements. Specifically, you're looking for DATE_FORMAT(). If your date is not coming from a database then you'll probably have to convert the date string you have to a unix timestamp and then use DATE() from there. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php