You are here: Re: To Get a Date into MySql: there must be a better way. « PHP Programming Language « IT news, forums, messages
Re: To Get a Date into MySql: there must be a better way.

Posted by adrian.price@gmail.com on 03/13/06 07:12

I've had a lot of success (and some serious "wow, that's cool"
reactions from users and execs) with a combination of strtotime and
active reponse to the user. I don't know what kind of target platform
you're looking at, but if you're able to expect a fairly recent browser
of your users, try using plain-text date fields with a JavaScript event
that makes an XmlHttpRequest back to your server, to a script (only
needs to be about 5 lines long) that returns the strtotime() of the
input text. It then replaces what the user typed into the date field
with the response from the server. So, for example, they type "next
tuesday", hit tab, the field fills out the full date and time, and they
can look at it and see that it's correctly interpretted their
plain-english date.

Also, as far as storing dates in MySQL itself - I've gotten in the
(admittedly somewhat odd) habit of storing all dates in the DB as plain
integer columns holding a UNIX timestamp. It may seem odd, but it
works, and it's what I'm used to, because I learned PHP/MySQL from
modding phpBB.

Hope that helps!!

 

Navigation:

[Reply to this 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

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