-
Notifications
You must be signed in to change notification settings - Fork 1
FormatDate
jdubs edited this page Oct 21, 2016
·
1 revision
Attempts to parse the input variable into a valid date time and format when specified.
SpecName (constant) The variable containing the input to be converted.
DateFormatCode (multiple | optional) The date time format code (see addendum 2).
ErrorMessage (multiple | optional) The error message to return when any error occurs.
This method accepts the value supplied in the variable and formats it utilizing the code supplied. The addendum is a list of all options available for formatting.
public static void FormatDate(string SpecName, object DateFormatCode, object ErrorMessage)
{
Break();
try
{
Variable(SpecName).Value = DateTime.Parse(Variable(SpecName).Value).ToString((string)DateFormatCode);
}
catch (Exception ex)
{
throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
}
}