0

In one of the API which I am trying to consume I am required to pass If-Modified-Since in the format of 2019-07-25T15:26:49+05:30. The Property for passing If-Modified-Since is DateTime in C#. How can we pass the parameter in the format with TimeZone into the same.

webReqeust.IfModifiedSince = DateTime.UtcNow;
Dilip Nair
  • 61
  • 1
  • 7
  • You do not need to format if you are passing a DateTime Object. The object contains the timezone and doe not need any modification. – jdweng Dec 06 '18 at 12:55
  • Yes that is true, but when you look at the data getting passed it seems to be without the TimeZone information. They are processing it directly and assuming that we are passing GMT, or probably interpreting based on their current server location. – Dilip Nair Dec 07 '18 at 04:12
  • See the source code strucuture : https://referencesource.microsoft.com/#mscorlib/system/datetime.cs,df6b1eba7461813b. It says " DateTime also stored some context about its time // zone in the form of a 3-state value representing Unspecified, Utc or // Local." – jdweng Dec 07 '18 at 09:50

0 Answers0