-
http://compatibility.shwups-cms.ch/en/home/?&&&property=Date.prototype.toLocaleFormat
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
-
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString
-
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString
var now = new Date();
now.getFullYear()
+ '-' + ('0' + (now.getMonth() + 1)).slice(-2)
+ '-' + ('0' + now.getDate()).slice(-2)
+ ' ' + now.toLocaleTimeString('en-GB');
// => "2013-09-06 10:02:22"
now.getFullYear()
+ '-' + ('0' + (now.getMonth() + 1)).slice(-2)
+ '-' + ('0' + now.getDate()).slice(-2)
+ ' ' + now.toTimeString();
// => "2013-09-06 10:02:22 GMT+0900 (JST)"
now.toLocaleString('en', {
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
timeZoneName: 'short'
});
// => "09/28/2013 10:02:22 AM Japan Time"
now.toLocaleString('en-US', {
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
timeZoneName: 'short'
});
// => "09/28/2013 10:02:22 AM Japan Time"
now.toLocaleString('en-GB', {
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
timeZoneName: 'short'
});
// => "28/09/2013 10:02:22 Japan Time"
now.toLocaleString('ja', {
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
timeZoneName: 'short'
});
// => "2013/09/28 10時02分22秒 JST"
Google Chrome 29.0.1547.76 (Official Build 223446)
OS Linux
Blink 537.36 (@156722)
JavaScript V8 3.19.18.23
Flash 11.8.800.170
User Agent Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36