Re: timestamp
| From: | graeme | Date: | Tue, 01 Feb 2005 07:10:00 +0000 |
| Subject: | Re: timestamp | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38411@lists.php.net to get a copy of this message | ||
what output do you get from the following?
<?php
$timestamp = "Fri Jan 28 19:53:09 2005";
echo $timestamp ."<br>";
$date = date("Y-m-d",strtotime($timestamp));
echo $date ."<br>";
phpinfo();
?>
graeme wrote:
The code works fine on my system, so what version of php are you using and what is your operating system? graeme. Balwant Singh wrote:ii just copy your code and paste into a test file. <? $timestamp = "Fri Jan 28 19:53:09 2005"; $date = date("Y-m-d",strtotime($timestamp)); echo $date; ?> with best wishes balwant On Tue, 2005-02-01 at 10:33, Bastien Koert wrote:usepls post relevant code bastienFrom: Balwant Singh <balwantsingh@indoasian.com> Reply-To: balwantsingh@indoasian.com To: Bastien Koert <bastien_k@hotmail.com> CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 01 Feb 2005 10:13:40 +0530 dear bastien thanks for the reply... but i checked it again but it is giving only 1970-01-01. is something else needs to be done. with best wishes balwant On Mon, 2005-01-31 at 19:46, Bastien Koert wrote:This code : <? $timestamp = "Fri Jan 28 19:53:09 2005"; $date = date("Y-m-d",strtotime($timestamp)); echo $date; ?> gave me this result 2005-01-28 Exactly as it should. BastienFrom: Balwant Singh <balwantsingh@indoasian.com> Reply-To: balwantsingh@indoasian.com To: Bastien Koert <bastien_k@hotmail.com> CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 31 Jan 2005 10:02:04 +0530 thanks I tried strtotime also but getting 1970-01-01 not 2005-01-28. my problem is that the date is given to me in string format i.e.Fri Jan 28 19:53:09 2005. Any other help will be appreciated. with best wishes balwant On Sat, 2005-01-29 at 22:45, Bastien Koert wrote:try $date = date("Y-m-d",strtotime($timestamp)); Best thing to use if you want to do calcs on date/time data istotheunix time stamp...translates the timestamp into seconds since 01-01-1970...Much simpler to use in sql queries BastienFrom: Balwant Singh <balwantsingh@indoasian.com> Reply-To: balwantsingh@indoasian.com To: php-db@lists.php.net Subject: [PHP-DB] timestamp Date: 29 Jan 2005 19:47:35 +0530 i am facing a problem i have timestamp in string format --> Fri Jan 28 19:53:09 2005now
want to get the date from it. is it possible? pls. help. on using strftime("%D",$timestamp) it is giving 01/01/70. May pls. help me. Also pls. let me know whether calculation can be done in mysql
onthis
string timestamp. pls. inform. with best wishes balwant -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/)To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/)To unsubscribe, visit: http://www.php.net/unsub.php
-- Experience is a good teacher, but she sends in terrific bills. Minna Antrim