Re: time from Mysql to php

From: Date: Tue, 02 Jan 2001 23:59:59 +0000
Subject: Re: time from Mysql to php
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5537@lists.php.net to get a copy of this message
To convert a MySQL timestamp to a Unix-style timestamp, which is used in php date/time function, use MySQL's UNIX_TIMESTAMP function. ex. "SELECT UNIX_TIMESTAMP(timestamp_column) as epoch_time FROM table" ----- Original Message ----- From: "Jaskirat Singh" <jaski@satyam.net.in> To: "Kevin McCarthy" <kevin@bodynsoul.com>; <php-db@lists.php.net> Sent: Saturday, December 30, 2000 6:45 AM Subject: Re: [PHP-DB] time from Mysql to php Hi Kevin, Below is an example ... you can look for more options in the manual under function strftime <? $string = '20001229162800'; echo $string; $new_string = strftime("%a %b",$string); echo $new_string; ?> HTH Jaski At 04:32 PM 12/29/00 -0800, Kevin McCarthy wrote: >I have several tables that use a date field but for the life of me I can't >figure how to use the values to show dates/times in various formats in PHP. > >The gist of it is, I capture timestamps in a MySQL record as >'20001229162800'. I need to use this value to show a time/date in PHP but >none of the PHP date/time functions seem to recognize this as a valid date >string. > >Do I need to perform a conversion on this string in order to further format >it in display? > >TIA. > > > >Kevin McCarthy Body & Soul >http://www.bodynsoul.com > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net >For additional commands, e-mail: php-db-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#5537) next »