help with displaying time

mrhankey
Posts: 45
Joined: 2010-07-31 18:20

help with displaying time

Post by mrhankey » 2010-10-14 11:54

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

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: help with displaying time

Post by Fred » 2010-10-16 15:08

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.

mrhankey
Posts: 45
Joined: 2010-07-31 18:20

Re: help with displaying time

Post by mrhankey » 2011-01-11 12:26

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

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: help with displaying time

Post by Fred » 2011-01-11 12:40

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.

Post Reply