Some time we need to add the date timestamp with Mili seconds in the time format (Dynamics _ACTUALS_Sep-2020_20210909_13111510) to our output file, so below code will do it:
class Runnable1
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
str s;
date dateValue = DateTimeUtil::getToday(DateTimeUtil::getUserPreferredTimeZone());
s = date2Str(dateValue,
123,
DateDay::None,
DateSeparator::Hyphen,
DateMonth::Short,
DateSeparator::Hyphen,
DateYear::Digits4
);
int time = timenow();
System.DateTime dateTime = System.DateTime::get_UtcNow();
str utcTimeAsStr = dateTime.ToString('HHmmssff');
// Use this format also and see the difference in timestamp value.
//str utcTimeAsStr = dateTime.ToString('HHmmssfff');
str customString = s + "_" + date2Str(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()),
321,
2,
DateSeparator::None,
2,
DateSeparator::None,
4)+ "_"+ utcTimeAsStr;
Info(strFmt("Format: %1", customString));
}
}
The Output would be:
No comments:
Post a Comment