I created a macro to do it. Not an expert in Slick-C, I made a function to do the zero padding but maybe there is a better way?
Sample output:
2022/10/03 02:59 PM EDT 2022/10/03 18:59 UTC
// Takes an integer and returns a string that is zero padded to 2 places, similar to %02d in printf
_str getZeroPadStr(int numToPad)
{
_str numAsStr = numToPad;
auto paddedNum = _pad(numAsStr, 2, "0", "L");
return paddedNum;
}
// Inserts into th editor the current time - localtime and UTC
_command void enterTimestamp() name_info(',' VSARG2_REQUIRES_EDITORCTL)
{
se.datetime.DateTime currentDateTime;
int yearLclInt, yearUtcInt;
int monthLclInt, monthUtcInt;
int dayLclInt, dayUtcInt;
int hourLclInt, hourUtcInt;
int minuteLclInt, minuteUtcInt;
int secondLclInt, secondUtcInt;
int msecLclInt, msecUtcInt;
currentDateTime.toParts(yearLclInt, monthLclInt, dayLclInt, hourLclInt, minuteLclInt, secondLclInt, msecLclInt, se.datetime.DT_LOCALTIME);
currentDateTime.toParts(yearUtcInt, monthUtcInt, dayUtcInt, hourUtcInt, minuteUtcInt, secondUtcInt, msecUtcInt, se.datetime.DT_UTCTIME);
_str yearLclStr = yearLclInt;
_str monthLclStr = getZeroPadStr(monthLclInt);
_str dayLclStr = getZeroPadStr(dayLclInt);
_str amPm = "AM";
if ( hourLclInt >= 12 )
{
amPm = "PM";
hourLclInt -= 12;
}
if ( hourLclInt == 0 )
{
hourLclInt = 12;
}
_str hourLclStr = getZeroPadStr(hourLclInt);
_str minuteLclStr = getZeroPadStr(minuteLclInt);
_str yearUtcStr = yearUtcInt;
_str monthUtcStr = getZeroPadStr(monthUtcInt);
_str dayUtcStr = getZeroPadStr(dayUtcInt);
_str hourUtcStr = getZeroPadStr(hourUtcInt);
_str minuteUtcStr = getZeroPadStr(minuteUtcInt);
_str tzName = strftime("%Z");
keyin(yearLclStr "/" monthLclStr "/" dayLclStr " " hourLclStr ":" minuteLclStr " " amPm " " tzName " ");
keyin(yearUtcStr "/" monthUtcStr "/" dayUtcStr " " hourUtcStr ":" minuteUtcStr " UTC" );
}