# Convert String To DateTime
Grammar — DateTime(string)
Flags —Native
|Function
Converts a colon delimited string of numbers to a DateTime. Returns Jan 1, 1970 for an invalid string.
# Arguments
string
— String
Returns — datetime
native datetime StringToDateTime(string inString);
# Related
Category: DateTime
- Convert DateTime To Integer —
int
— DateTimeToInt - Convert Integer To DateTime —
datetime
— IntToDateTime - Convert DateTime To String —
string
— DateTimeToString - Convert String To DateTime —
datetime
— StringToDateTime - Current DateTime —
datetime
— CurrentDateTimeGet - Initial DateTime —
datetime
— InitialDateTimeGet - Get DateTime Year —
int
— GetDateTimeYear - Get DateTime Month —
int
— GetDateTimeMonth - Get DateTime Day —
int
— GetDateTimeDay - Get DateTime Hour —
int
— GetDateTimeHour - Get DateTime Minute —
int
— GetDateTimeMinute - Get DateTime Second —
int
— GetDateTimeSecond - Get DateTime Weekday Index —
int
— GetDateTimeWeekday - Synchronous Game Start Time —
int
— SynchronousGameStartTimeGet - Current Synchronous Game Time —
int
— CurrentSynchronousGameTimeGet - Get Current Day of Week —
string
<preset::Weekday> — libNtve_gf_GetCurrentDayofWeek - DateTime is Before —
bool
— DateTimeIsBefore - DateTime is After —
bool
— DateTimeIsAfter - DateTime is Between —
bool
— libNtve_gf_DateTimeisBetween - Get Weekday From DateTime —
string
<preset::Weekday> — libNtve_gf_GetWeekdayFromDateTime - Get Month From DateTime —
string
<preset::Month> — libNtve_gf_GetMonthFromDateTime - DateTime is Weekend —
bool
— libNtve_gf_DateTimeisWeekend - DateTime is Morning —
bool
— libNtve_gf_DateTimeisMorning - DateTime is Afternoon —
bool
— libNtve_gf_DateTimeisAfternoon - DateTime is Evening —
bool
— libNtve_gf_DateTimeisEvening - Format DateTime as String —
string
— libNtve_gf_FormatDateTimeasString - Weekday — preset —
string
- Month — preset —
string
# Examples
mods/liberty.sc2mod — base.sc2data/TriggerLibs/LibertyLib.galaxy:961
for ( ; auto0F553801_i <= UserDataInstanceCount(auto0F553801_userType) ; auto0F553801_i += 1 ) {
lv_itInstance = UserDataInstance(auto0F553801_userType, auto0F553801_i);
lv_itStart = StringToDateTime(UserDataGetString(libLbty_gv_starCraftEventsEventTable, lv_itInstance, "Start", 1));
lv_itEnd = StringToDateTime(UserDataGetString(libLbty_gv_starCraftEventsEventTable, lv_itInstance, "End", 1));
lv_itDisabler = UserDataGetGameLink("SCEvent_Events", lv_itInstance, "Disabler", 1);
mods/liberty.sc2mod — base.sc2data/TriggerLibs/LibertyLib.galaxy:962
lv_itInstance = UserDataInstance(auto0F553801_userType, auto0F553801_i);
lv_itStart = StringToDateTime(UserDataGetString(libLbty_gv_starCraftEventsEventTable, lv_itInstance, "Start", 1));
lv_itEnd = StringToDateTime(UserDataGetString(libLbty_gv_starCraftEventsEventTable, lv_itInstance, "End", 1));
lv_itDisabler = UserDataGetGameLink("SCEvent_Events", lv_itInstance, "Disabler", 1);
lv_itSkin = UserDataGetGameLink("SCEvent_Events", lv_itInstance, "Skin", 1);