1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-07 16:06:15 +00:00

Added ToRfc3339String extension method for DateTime

This commit is contained in:
Jkorf 2024-10-07 12:57:04 +02:00
parent c614b7869c
commit bbbdac2fd3

View File

@ -189,6 +189,16 @@ namespace CryptoExchange.Net
throw new ArgumentException($"No values provided for parameter {argumentName}", argumentName); throw new ArgumentException($"No values provided for parameter {argumentName}", argumentName);
} }
/// <summary>
/// Format a string to RFC3339/ISO8601 string
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ToRfc3339String(this DateTime dateTime)
{
return dateTime.ToString("yyyy-MM-dd'T'HH:mm:ss.fffzzz", DateTimeFormatInfo.InvariantInfo);
}
/// <summary> /// <summary>
/// Format an exception and inner exception to a readable string /// Format an exception and inner exception to a readable string
/// </summary> /// </summary>