Page 1 of 1
date to time()
Posted: Tue Jul 20, 2004 1:41 am
by ddragas
Hi all!
I've got form in one page that posts value of date (written in textbox) to second page.
I've got two questions.
In what format should date be written in text box
date month year
month date year
month/date/year
or how
second question
how to convert that date to time()
Posted: Tue Jul 20, 2004 2:15 am
by feyd
1. If it's in english/language, it can be any of those I think. If it's numbers, you may need to fiddle around with it..
2. [php_man]strtotime[/php_man]
Posted: Tue Jul 20, 2004 9:31 am
by pickle
I may be wrong, but I think the American standard is Month/Day/Year and the British (and Canadian and probably everywhere else) standard is Day/Month/Year.
I'd make each section it's own textbox. Then, you can easily use [php_man]mktime[/php_man]() to get your timestamp.
Posted: Tue Jul 20, 2004 12:12 pm
by ddragas
If I write in textbox month/day/year it works.
How can I write it in day/month/year
Posted: Tue Jul 20, 2004 12:18 pm
by litebearer
not the prettiest, but by using php generated dropdowns for the month, date and year you sidestep any confusion and are easily able to redisplay in any format you choose.
Posted: Tue Jul 20, 2004 1:00 pm
by pickle
What's your setup? Do you have just a plain HTML textbox? If so, you could type anything you want in there, it's just a matter of how it is handled on the second page.
Your best bet is to convert whatever format you choose to timestamp as soon as possible, as it's much easier to handle and manipulate.
Posted: Wed Jul 21, 2004 5:43 am
by qads
i got around this problem by useing javascript....which wont work on some computer cos the whole 'javascript is evil' deal, but it was for admin area on a project, so its ok

.
get a popup calendar script, such as
http://www.dynamicdrive.com/dynamicinde ... lendar.htm
http://www.dynamicdrive.com/dynamicinde ... endar2.htm
then make the textbox READ ONLY, so users cant type it in, they must select a date, simple eh

.
Posted: Wed Jul 21, 2004 9:15 am
by ddragas
thank you for advice. I'll do that