Reply to Re: [PHP] PHP date returns wrong value ??

Your name:

Reply:


Posted by Jason Wong on 01/16/05 15:29

On Sunday 16 January 2005 15:22, Michael Gale wrote:

Not a direct answer to your problem ...

> $query="INSERT INTO tentry_table SET ticket_id = '" . $ticket . "',";
> $query .= " tentry_date = '" . date("Y-m-d") . "',";
> $query .= " tentry_time = '" . date("H:j:s") . "',";

1) When doing something involving date/time it is best practice to assign
date/time *once* to a variable then work off of that variable. This ensures
that your date/time is consistent withing that block of code.

2) If there is no particular reason why you are storing the date and the time
separately why not just use a DATETIME field? Then you can just use the
builtin db function NOW(). Or, if that datetime never changes once assigned,
you could even use a TIMESTAMP field.

--
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
------------------------------------------
New Year Resolution: Ignore top posted posts

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация