justlukeyou — 2013-01-13T16:03:04-05:00 — #1
Im trying to set a form in which people can insert dates. For example they can insert their birthday. However Im not sure in which format they should be entered in.
Is there a standard method of dealing wth dates. Should I have one column for day, one for the month and one for the year. Or should they all be entered into one column.
Is there standard way of using dates?
sogo7 — 2013-01-13T23:34:55-05:00 — #2
The date input on the form should ideally be split into three dropdown boxes (Year, Month, Day) then you stick them all together as a single string with a delimiter character when it gets to the webserver eg: 1968-12-23 This way there is no chance of people stuffing up the format or putting in stupid dates, now the string can then be inserted into a single column of a typical SQL database. If the column format/attribute is set to 'Datetime' you can then use SQL commands to easily sort the rows of data by the users birthdays.
starlion — 2013-01-14T08:39:36-05:00 — #3
or else feed it through strtotime, and reject the form submission if you get false back; that way you can accept the standard formats. The dropdowns are the better solution.
cups — 2013-01-14T10:11:43-05:00 — #4