Suppose I have a datetime string 10/09/2019 10:03:00.000 AM
.
Now, if I am in USA, I'll read it as 9th October 2019 and if I am in India, I'll read it as 10th September 2019.
So, my question is how do I parse this string as a Date object in such a way that it is parsed based on the local timezone.
I am using luxon
, but, pure javascript solution will also work.
day/month/year
vsmonth/day/year
. If you want that handled properly, you'll likely have to allow your users to set their date format preference, but hopefully for display only. Most systems expect dates/timestamps to be handled inyear-month-day hour:minute:second
, with or without timezone (+/- offset) included. – NugatoryfromFormat
expects a format to be provided. I want automatic parsing based on culture. I guess as Tim suggested, I need to switch toyear-month-day hour:minute:second
– Glandule