Page 1 of 1

help with displaying time

Posted: 2010-10-14 11:54
by mrhankey
hi,

i have an existing database which has one field for the date it is due which is "date" type.

the other is a time to call "time" type in the database.

i am unsure how i can specify in the wizard how to display the time as it only asks the start date which i set as the date type.

anyone ablt to guid me or if i change to a datetime how can i get a user to input the date and time in the input field with ease?

many thanks

Re: help with displaying time

Posted: 2010-10-16 15:08
by Fred
It is easiest to leave the two fields separately for the date and the time.

What you would need to do in your mysql query is to combine the two fields the way the calendat expectes to find it. i.e. datetime()

Code: Select all

SELECT `calendar_data`.`cal_id`, CONCAT_WS(' ',`calendar_data`.`date_start`,`calendar_data`.`time_start`) AS `s_date`, CONCAT_WS(' ',`calendar_data`.`date_end`,`calendar_data`.`time_end`) AS `e_date`,...
If you change the fields to datetime() you can use the datepicker SB with a datetime format to select the date and time. I found it to be a bit awkward.

Re: help with displaying time

Posted: 2011-01-11 12:26
by mrhankey
thanks for your help with this. i ended up using the date and time picker. hopefully it will be ok. failing that i will try changing the query.

thanks again

Re: help with displaying time

Posted: 2011-01-11 12:40
by Fred
I also used the date-time picker but I found the users had a problem with working the "time selector".

Thats why I eventually split the date and time into two fields and just use the CONCAT_WS() mysql function to combine the two fields.

Still using the date_picker but have a simple dropdown for the time.