CSharp examples for System:DateTime Time
To Client Time from HttpContext
using System.Web; using System.Linq; using System.Globalization; using System.Collections.Generic; using System;//from ww w .j a v a 2 s .c om public class Main{ public static string ToClientTime(this DateTime dt) { var timeOffSet = HttpContext.Current.Session["timezoneoffset"]; // read the value from session if (timeOffSet != null) { var offset = int.Parse(timeOffSet.ToString()); dt = dt.AddMinutes(-1 * offset); return dt.ToString(); } // if there is no offset in session return the datetime in server timezone return dt.ToLocalTime().ToString(); } }