JavaScript - Get system short date format -


is there way system short date format in javascript?

for example whether system's short date in american format eg. m/d/y or in european eg. d/m/y

please note: not question formatting date or calculating based on geolocation, getting format os/system

after pinch of research concluded technically it's not possible regional settings -and this, date format- can several other things. pick 1 of these options:
a) mentioned -and outdated- "tolocalestring()" function:

var mydate = new date(1950, 01, 21, 22, 23, 24, 225); var mydateformat = mydate.tolocalestring(); alert (mydateformat);

issues:
1) can't "mydateformat.replace" date mask month not stored "01", "02", etc in string text instead, based on locale (like "february" in english it's "Φεβρουάριος" in greek , knows in e.g. klingon).
2) different behavior on different browsers
3) different behavior on different os , browser versions...

b) use toisostring() function instead of tolocalestring(). won't locale date mask date can tell where's part of date (ie "month" or "day" in string). can work getutcdate(), getutcmonth() , getutcday() functions. still can't tell date format client uses, can tell year/month/day/etc work when grab date; use code above test functions mentioned here see can expect.

c) read inconsistent behavior of tolocalestring() in different browser article , use (imho great) solution described there


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -