VirtualUserScript FormatDateTime Method C# API
Converts a DateTime object to its equivalent string representation using the specified format.

Namespace: Facilita.Fc.Runtime
Assembly: fc_clr (in fc_clr.dll) Version: 9.5.7.98
Syntax

public static string FormatDateTime(
	string format,
	DateTime dateTime = null,
	TimeSpan offset = null,
	TimeZoneInfo timeZoneInfo = null,
	TimeSpan timeZoneOffset = null,
	IFormatProvider formatProvider = null
)

Parameters

format
Type: System String
The date and time format string
dateTime (Optional)
Type: System DateTime
The DateTime object to be represented as a string. If this argument is omitted then the current DateTime will be used.
offset (Optional)
Type: System TimeSpan
An offset to apply to the DateTime object before it is formatted. If this argument is omitted, then no offset will be applied.
timeZoneInfo (Optional)
Type: System TimeZoneInfo
The time zone to use. If this value is not specifed, then the local timezone will be used.
timeZoneOffset (Optional)
Type: System TimeSpan
An offset from UTC of the time zone to use. Note that this argument is ignored if a timeZoneInfo is specified.
formatProvider (Optional)
Type: System IFormatProvider
An object that supplies culture-specific formatting information. If this argument is omitted, then the current culture will be used.

Return Value

A string representation of the DateTime.
Remarks

The format string should be a standard date and time format string, as described Onlinehere
Examples

// format the current DateTime, plus one hour 
string formattedDateTime = FormatDateTime("yyyy-MM-dd HH:mm:ss", offset: TimeSpan.FromHours(1));
See Also