Hi NetAdmin Thanks for letting me know about that interesting function, but it isn't what I need.
In the form I want a TimePicker and then before saving to the database, I want to add a date to the time. When retrieving an existing record, I would need to separate the time and show it in the form input/timepicker and keep the date separately (perhaps in a hidden field) and then when re-saving to the database, re-assemble the date and time together. Thanks, D On Oct 11, 2:20 pm, NetAdmin <mr.netad...@gmail.com> wrote: > Is this what you're trying to do? > This will round the time DOWN to 30 minute intervals. > On the hour or 30 minutes past the hour using MySQL time and math > functions. > > select sec_to_time( time_to_sec( '2010-10-11 07:40:00' ) - > time_to_sec( '2010-10-11 07:40:00') mod(1800) )as ans; > +----------+ > | ans | > +----------+ > | 07:30:00 | > +----------+ > 1 row in set (0.00 sec) > > Mr.NetAdmin > > On Oct 10, 6:21 pm, villas <villa...@gmail.com> wrote: > > > For a Datetime field... > > > On creating a record I wish to use a default date (say today) and > > choose only the time (selected from half hour intervals), e.g. > > 10:30, 14:00, 19:30 etc. > > > On editing a record, I would maintain the date but simply allow the > > time to be edited. > > > Can anyone make a suggestion to handle that elegantly? > > > Thks, David > >