using System.Globalization;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
public enum DateTimeFormat
public static string GetFormattedDate(DateTime? dateTime, int timeOffset, CultureInfo language, DateTimeFormat dateTimeFormat = DateTimeFormat.LongDate)
string dateFormat = language.DateTimeFormat.FullDateTimePattern;
if (dateTimeFormat == DateTimeFormat.ShortDate)
dateFormat = language.DateTimeFormat.ShortDatePattern;
DateTime utcDateTime = new DateTime(dateTime.Value.Year, dateTime.Value.Month, dateTime.Value.Day, dateTime.Value.Hour, dateTime.Value.Minute, dateTime.Value.Second, DateTimeKind.Utc);
TimeZoneInfo сustomеTimeZoneInfo = TimeZoneInfo.CreateCustomTimeZone("CustomTimeZone", new TimeSpan(0, 0, -timeOffset, 0), "CustomTimeZone", "CustomTimeZoneDisplayName"); ;
return TimeZoneInfo.ConvertTime(utcDateTime, сustomеTimeZoneInfo).ToString(dateFormat);
public static void Main()
Console.Write(GetFormattedDate(DateTime.Now, 0, Thread.CurrentThread.CurrentCulture, DateTimeFormat.LongDate ));