Skip to content

FormatDate

jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents

Overview

Attempts to parse the input variable into a valid date time and format when specified.

Parameters

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.

Synopsis

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.

Source Code

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);
	}
}

Referenced Methods

Clone this wiki locally