5 static string GetDateTimeLocal()
7 int year, month, day, hour, minute, second;
8 System.GetYearMonthDay(year, month, day);
9 System.GetHourMinuteSecond(hour, minute, second);
10 return SCR_FormatHelper.FormatDateTime(year, month, day, hour, minute, second);
15 static string GetDateTimeUTC()
17 int year, month, day, hour, minute, second;
18 System.GetYearMonthDayUTC(year, month, day);
19 System.GetHourMinuteSecondUTC(hour, minute, second);
20 return SCR_FormatHelper.FormatDateTime(year, month, day, hour, minute, second);
32 static string GetDateString(
int day,
int month,
int year,
bool verbose =
true)
37 date = WidgetManager.Translate(
"#AR-Date_Format_MonthFull", day,
SCR_DateTimeHelper.GetMonthString(month), year);
39 date = WidgetManager.Translate(
"#AR-Date_Format", day, month, year);
52 static string GetMonthString(
int month,
bool standalone =
false)
54 if (month < 1 || month > 12)
62 "#AR-Date_January_Standalone",
63 "#AR-Date_February_Standalone",
64 "#AR-Date_March_Standalone",
65 "#AR-Date_April_Standalone",
66 "#AR-Date_May_Standalone",
67 "#AR-Date_June_Standalone",
68 "#AR-Date_July_Standalone",
69 "#AR-Date_August_Standalone",
70 "#AR-Date_September_Standalone",
71 "#AR-Date_October_Standalone",
72 "#AR-Date_November_Standalone",
73 "#AR-Date_December_Standalone",
94 return months[month -1];
103 static string GetAbbreviatedMonthString(
int month)
105 if (month < 1 || month > 12)
109 array<string> months = {
110 "#AR-Date_January_StandaloneShort",
111 "#AR-Date_February_StandaloneShort",
112 "#AR-Date_March_StandaloneShort",
113 "#AR-Date_April_StandaloneShort",
114 "#AR-Date_May_StandaloneShort",
115 "#AR-Date_June_StandaloneShort",
116 "#AR-Date_July_StandaloneShort",
117 "#AR-Date_August_StandaloneShort",
118 "#AR-Date_September_StandaloneShort",
119 "#AR-Date_October_StandaloneShort",
120 "#AR-Date_November_StandaloneShort",
121 "#AR-Date_December_StandaloneShort",
124 return months[month -1];
129 static int GetTimeDifference(
int hour0,
int minute0,
int second0,
int hour1,
int minute1,
int second1, out
int hour = 0, out
int minute = 0, out
int second = 0)
131 int time0 = GetSecondsFromHourMinuteSecond(hour0, minute0, second0);
132 int time1 = GetSecondsFromHourMinuteSecond(hour1, minute1, second1);
134 int result = time0 - time1;
138 GetHourMinuteSecondFromSeconds(result, hour, minute, second);
145 static string GetTimeDifferenceFormatted(
int hour0,
int minute0,
int second0,
int hour1,
int minute1,
int second1)
147 int hour, minute, second;
148 GetTimeDifference(hour0, minute0, second0, hour1, minute1, second1, hour, minute, second);
154 static string GetTimeLocal()
156 int hour, minute, second;
157 System.GetHourMinuteSecond(hour, minute, second);
163 static string GetTimeUTC()
165 int hour, minute, second;
166 System.GetHourMinuteSecondUTC(hour, minute, second);
179 static void GetDayHourMinuteSecondFromSeconds(
int totalSeconds, out
int outDays, out
int outHours, out
int outMinutes, out
int outSeconds)
181 if (totalSeconds < 0)
184 outDays = totalSeconds / 86400;
185 outHours = (totalSeconds % 86400) / 3600;
186 outMinutes = (totalSeconds % 3600) / 60;
187 outSeconds = totalSeconds % 60;
198 static void GetHourMinuteSecondFromSeconds(
int totalSeconds, out
int outHours, out
int outMinutes, out
int outSeconds)
200 if (totalSeconds < 0)
203 outHours = totalSeconds / 3600;
204 outMinutes = (totalSeconds % 3600) / 60;
205 outSeconds = totalSeconds % 60;
213 static int GetSecondsFromHourMinuteSecond(
int hour = 0,
int minute = 0,
int second = 0)
215 return hour * 3600 + minute * 60 + second;
227 static int ConvertDateIntoMinutes(
int year = 0,
int month = 0,
int day = 0,
int hour = 0,
int minutes = 0)
229 return (year * 525600) + (month * 43800) + (day * 1440) + (hour * 60) + minutes;
242 static void ConvertMinutesIntoDate(
int totalDateMinutes, out
int year, out
int month, out
int day, out
int hour, out
int minutes)
244 year = totalDateMinutes / 525600;
245 totalDateMinutes -= year * 525600;
247 month = totalDateMinutes / 43800;
248 totalDateMinutes -= month * 43800;
250 day = totalDateMinutes / 1440;
251 totalDateMinutes -= day * 1440;
253 hour = totalDateMinutes / 60;
254 totalDateMinutes -= hour * 60;
256 minutes = totalDateMinutes;