I’m trying to apply date format on simple date/time picker but I don’t know what I’m doing wrong applying format is working ok but when I’m saving this date value in database its not in the format which I applied, I need to save it in same format I applied
Hello! It’s saved in the correct format, even though the preview displays it as “Jul 3, 2022 2:09 pm”. Click on the pen icon and you can see the actual database entry, which will be formatted “07/03/2022 12:00 am”
Hope this helps
A date value is a time stamp… formatting is soemthing you do with that time stamp when you want to display it somewhere (or convert it into a text)…
So if you want to store the actual date value as a date then you can’t apply any formatting to it (that wouldn’t make sense)…
You apply formatting to a date when you want to display it (i.e. on the page)
Unless (for some reason) you want to save the date as a text in your database, in which case you can apply formatting to the date/time picker’s value to change it into a text (note: the format field in the date picker element is just for the way the date displays on the element - if you want to save the date as a text then you’ll need to apply formatting to the actual value).
This topic was automatically closed after 70 days. New replies are no longer allowed.