Not getting correct time from UniversalDateTime
- by Nakul Chaudhary
I send a vcal through mail in web application with convert datetime to universal datetime.
If i run web application locally (local sevser in India) i get correct time in my vcal.
But run appication live (server in US) then not get corret time with a difference of 1 and half hour.Please suggest me.
code :
Dim result As StringBuilder = New StringBuilder()
result.AppendFormat("BEGIN:VCALENDAR{0}", System.Environment.NewLine)
result.AppendFormat("BEGIN:VEVENT{0}", System.Environment.NewLine)
result.AppendFormat("SUMMARY:{0}{1}", subject, System.Environment.NewLine)
result.AppendFormat("LOCATION:{0}{1}", location, System.Environment.NewLine)
result.AppendFormat("DTSTART:{0}{1}", startDate.ToUniversalTime().ToString("yyyyMMdd\THHmmss\Z"), System.Environment.NewLine)
result.AppendFormat("DTEND:{0}{1}", endDate.ToUniversalTime().ToString("yyyyMMdd\THHmmss\Z"), System.Environment.NewLine)
result.AppendFormat("DTSTAMP:{0}{1}", DateTime.Now.ToUniversalTime().ToString("yyyyMMdd\THHmmss\Z"), System.Environment.NewLine)
result.AppendFormat("DESCRIPTION:{0}{1}", description, System.Environment.NewLine)
result.AppendFormat("END:VEVENT{0}", System.Environment.NewLine)
result.AppendFormat("END:VCALENDAR{0}", System.Environment.NewLine)
Return result.ToString()