Adding TIME to input filed & displaying TIME on dynamic page

I need to create an input form for Date AND TIME for an event. These 2 data elements need to be stores in a db and then displayed on a dynamic page. I have no problem with the date and date picker input form, but how do I enter time and then display time on another page. Do I need 2 fields in my data base one for date another for time? if so how do I set the time format?

2 Likes

You can create 2 fields and make two dropdowns, use the datepicker control for date and then create a dropdown with all time intervals you want. You can create an JSON like object in code and then populate a dropdown with those values if you want and then store both of them in one field on in separate. If you need to search or filter on both I suggest you use two fields.

Andy, Thank you for your reply. I am curious though as to why the Field Property is Dtae AND Time. ALso look at the screen shot that shows the filed does store a time cariable. The issue is how to write to it and how to display it. Any ideas?

Hi, I have the same problem. Were you able to remove it?

Not yet, I tried the olson method but I couldn’t get that working either.

Thanks Andreas, I guess I will have to use a work around as I can’t put this online and I can’t delay this thing. I’m sure Wix will fix it as it doesn’t make sense to keep it like that. Cheers!

If I remember correctly, dates in Unix/Javascript are stored as numbers counting from the Revolutionary date of 1/1/1970, in milliseonds. So the “date” you see is not stored as a date, but a a number. It is displayed by calculating the date first. And what is left, is the time. Thats why date/time in the Content Manager are displayed as two separate things, but in reality they are 1.

Hi, I found that this works:

export function dynamicDataset_ready() {
let itemObj = $w(“#dynamicDataset”).getCurrentItem();
$w(“#text126”).text = itemObj.arrivalDate.toDateString();
}

Change the following:
dynamicDataset - The name of your dataset
$w(“#text126”).text - The name of the date text field

2 Likes

Hi. I’m a novice to Wix. So I just wanted to clarify where this bit of code goes and how it works.