Search code examples
sqlcompact-framework

DateTimeOffset Support in Compact Framework 3.5


Does anyone know if the data type "DateTimeOffset" is supported in the .NET Compact Framework 3.5?


Solution

  • No, it's not. Can you tell us what your usage scenario is and maybe we can suggest a workaround? My guess is you can create your own class something like this that would probably work:

    class MyDateTimeOffset
    {
        public DateTime UTCTime { get; set; }
        public int BiasInMinutes { get; set; }
    
        public DateTime AsLocalTime()
        {
            var localBias = (DateTime.Now - DateTime.UtcNow).TotalMinutes;
    
            return UTCTime.AddMinutes(BiasInMinutes - localBias);
        }
    }