33wxString toUsrDateTimeFormat(
const wxDateTime date_time,
35 wxDateTime t(date_time);
36 wxString effective_time_zone =
options.time_zone;
37 if (effective_time_zone == wxEmptyString) {
38 effective_time_zone = ::g_datetime_format;
40 if (effective_time_zone == wxEmptyString) {
41 effective_time_zone =
"UTC";
44 std::vector<std::pair<wxString, wxString>> formatMap = {
45#if wxCHECK_VERSION(3, 1, 6)
50 wxUILocale::GetCurrent().GetInfo(wxLOCALE_LONG_DATE_FMT) +
" " +
51 wxUILocale::GetCurrent().GetInfo(wxLOCALE_TIME_FMT)},
52 {
"$long_date", wxUILocale::GetCurrent().GetInfo(wxLOCALE_LONG_DATE_FMT)},
53 {
"$weekday_short_date_time",
54 "%a " + wxUILocale::GetCurrent().GetInfo(wxLOCALE_SHORT_DATE_FMT) +
" " +
55 wxUILocale::GetCurrent().GetInfo(wxLOCALE_TIME_FMT)},
56 {
"$weekday_short_date",
57 "%a " + wxUILocale::GetCurrent().GetInfo(wxLOCALE_SHORT_DATE_FMT)},
59 wxUILocale::GetCurrent().GetInfo(wxLOCALE_SHORT_DATE_FMT) +
" " +
60 wxUILocale::GetCurrent().GetInfo(wxLOCALE_TIME_FMT)},
62 wxUILocale::GetCurrent().GetInfo(wxLOCALE_SHORT_DATE_FMT)},
63 {
"$hour_minutes_seconds",
64 wxUILocale::GetCurrent().GetInfo(wxLOCALE_TIME_FMT)},
66 {
"$long_date_time",
"%x %X"},
69 {
"$weekday_short_date_time",
"%a %x %X"},
70 {
"$weekday_short_date",
"%a %x"},
71 {
"$short_date_time",
"%x %X"},
72 {
"$short_date",
"%x"},
73 {
"$hour_minutes_seconds",
"%X"},
75 {
"$hour_minutes",
"%H:%M"},
76 {
"$24_hour_minutes_seconds",
"%H:%M:%S"},
78 wxString format =
options.format_string;
79 if (format == wxEmptyString) {
80 format =
"$weekday_short_date_time";
83 for (
const auto& pair : formatMap) {
84 format.Replace(pair.first, pair.second);
87 if (effective_time_zone ==
"Local Time") {
88 wxDateTime now = wxDateTime::Now();
89 if ((now == (now.ToGMT())) &&
91 t.Add(wxTimeSpan(1, 0, 0, 0));
97 wxString tzName = t.Format(
"%Z");
98 ret = t.Format(format) +
" " + tzName;
99 }
else if (effective_time_zone ==
"UTC") {
101 ret = t.ToUTC().Format(format) +
" " + _(
"UTC");
102 }
else if (effective_time_zone ==
"LMT") {
105 if (std::isnan(
options.longitude)) {
106 t = wxInvalidDateTime;
108 t.Add(wxTimeSpan(0, 0, wxLongLong(
options.longitude * 3600. / 15.)));
110 ret = t.Format(format) +
" " + _(
"LMT");
113 ret = t.ToUTC().Format(format) +
" " + _(
"UTC");