I want client system date and time format using javascript or jquery
Went i use this code
const dateTimeFormat = new Intl.DateTimeFormat();
const currentDateTime = new Date().toLocaleString(dateTimeFormat.resolvedOptions().locale);
console.log(currentDateTime);
4/24/2023, 2:42:38 PM
it return this response
but my system display 24-04-2023 14:57
How to get saystem date and time format based on client system see this image
I Want -
Diff country use to show date and time format in diff format
like india - dd-mm-yyyy USA - mm-dd-yyyy
So i want to know what date and time format is used to display there device or window operating system to see date time
I want to retrieve the date and time format used by the client system using JavaScript or jQuery.
For example, when I use this code:
const dateTimeFormat = new Intl.DateTimeFormat(); const currentDateTime = new Date().toLocaleString(dateTimeFormat.resolvedOptions().locale); console.log(currentDateTime);
It returns a response in the format 4/24/2023, 2:42:38 PM, while my system displays 24-04-2023 14:57.
I want to obtain the date and time format based on the client system, as different countries use different formats, such as dd-mm-yyyy in India and mm-dd-yyyy in the USA.
How can I determine the date and time format used by the client's device or window operating system?