1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import QtQuick 2.0
QtObject {
property var locale: Qt.locale()
function setLocale(l) {
locale = Qt.locale(l)
}
// Month number 9 is October: JS Date()'s month range is 0 to 11.
function toLocaleString(fmt) {
var d = new Date(2011, 9, 7, 18, 53, 48, 345);
if (fmt < 0)
return d.toLocaleString(locale);
else
return d.toLocaleString(locale, fmt);
}
function toLocaleDateString(fmt) {
var d = new Date(2011, 9, 7, 18, 53, 48, 345);
if (fmt < 0)
return d.toLocaleDateString(locale);
else
return d.toLocaleDateString(locale, fmt);
}
function toLocaleTimeString(fmt) {
var d = new Date(2011, 9, 7, 18, 53, 48, 345);
if (fmt < 0)
return d.toLocaleTimeString(locale);
else
return d.toLocaleTimeString(locale, fmt);
}
function fromLocaleString(d,fmt) {
return Date.fromLocaleString(locale, d, fmt)
}
function fromLocaleDateString(d,fmt) {
return Date.fromLocaleDateString(locale, d, fmt)
}
function fromLocaleTimeString(d,fmt) {
return Date.fromLocaleTimeString(locale, d, fmt)
}
}
|