Try our conversational search powered by Generative AI!

Utc Date Times & DXC


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?

Nov 14, 2017 16:32

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 :) ) 

Nov 14, 2017 17:20
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.