Commerce DB TimeStamp is UTC. WEbsite shows incorrect date and time.

Vote:
 

Episerver saves all datetimes in UTC in database. And then they show all timestamp on website in local timestamp. All our classes use Mediachase.Web.Console.Common.ManagementHelper. And this class is suppose to implement GetUserDateTime method to convert it to local time stamp. But unfortunately episerver has not implemented this method. Hence we see the UTC times which is not correct.

///
              /// Returns datetime value converted based on current user's settings.
              ///
              /// DateTime in UTC.
              ///
              public static DateTime GetUserDateTime(DateTime dt)
              {
                     // TODO: need to store time zone settings for each user and display datetime based on these settings.
                     return dt.ToLocalTime();
              }

Article reference is  -http://world.episerver.com/Forum/Developer-forum/EPiServer-Commerce/Thread-Container/2012/5/Setting-Up-Commerec-site-in-different-timezones/

#119314
Mar 26, 2015 17:39
Vote:
 

Hi,

I'm not sure what you meant "has not implemented this method". This method converts UTC time to local time and it works this way. What hadn't been implemented (the TODO) was the timezone setting per user (which was abandoned future). 

In Commerce 7.5 the method was obsoleted and we recommend to use ToLocalTime directly.

Regards.

/Q

#119427
Mar 27, 2015 11:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.