diff --git a/duo_api_csharp/Duo.cs b/duo_api_csharp/Duo.cs index d809085..75de05c 100644 --- a/duo_api_csharp/Duo.cs +++ b/duo_api_csharp/Duo.cs @@ -492,7 +492,12 @@ private static string DateToRFC822(DateTime date) // between the offset's hours and minutes. string date_string = date.ToString( "ddd, dd MMM yyyy HH:mm:ss", CultureInfo.InvariantCulture); - int offset = TimeZoneInfo.Local.GetUtcOffset(date).Hours; + int offset = 0; + // set offset if input date is not UTC time. + if (date.Kind != DateTimeKind.Utc) + { + offset = TimeZoneInfo.Local.GetUtcOffset(date).Hours; + } string zone; // + or -, then 0-pad, then offset, then more 0-padding. if (offset < 0)