Hi, I am hoping you guys can just shorten the time I need to find the right combination of codeless to get my desired result.
For a variety of reasons, my client has a use case where we need to collect the date and the time separately. For the date field, I am using a normal datepicker component set to date only. To get the time, I have a select field that allows the user to set a variety of preset times. This is in the form of strings right now (i.e. 10:00 AM, 3:00 PM, etc) but could be changed.
Can you show a quick example of codeless that would allow me to take these two inputs and assemble a single datetime value that could be stored into a separate database field where all other data is coming from a normal datetime picker?
Thanks!
James
Note that the options for the strings in the select box need to be populated dynamically from a single field in a database table.
i.e. a table with a field for each record called, “Preset Times” that lists the times that are available to choose for that record. Currently I have this setup as a multiselect field, which results in a comma delimited string.
Hi James,
I do not have a Codeless example, but the algorithm I’d follow is:
- Create a date object with the date selected by the user and time set to 00:00:00
- Add the selected number of hours to the date from 1
- Add the selected number of minutes to the date from 2
Regards,
Mark
Ahh, good call! That will make it easy too. I can convert the hours and minutes to milliseconds and then add directly to the date coming out of the datepicker as well.
I’ll give that a shot. Thanks!