Utc Date Times & DXC

Member since: 2010

Hi all,

Can someone clarify how the datetimes should be working with publishing. I'm programatically setting StopPublish on some items (commerce items but would also be CMS items) for a site hosted on the DXC. Should these now be DateTime.UtcNow, the docs say they are auto translated via the APIs so should be continue using DateTime.Now instead?

#185292 Nov 14, 2017 16:32
  • Member since: 2011

    For Commerce contents, the rule of thumb is to always set DateTime value in Utc. Yes system fields like StopPublish will be converted to Utc prior-save by the framework, but it does not hurt have the time in Utc already (an extra .ToUniversalTime() would be very cheap compared to the data saving itself). And you never know if there is a bug in framework that some code forgets to do the conversion (very very unlikely, but not impossible :) ) 

    #185293 Nov 14, 2017 17:20