Not getting correct time from UniversalDateTime

Posted by Nakul Chaudhary on Stack Overflow See other posts from Stack Overflow or by Nakul Chaudhary
Published on 2009-04-16T06:33:14Z Indexed on 2010/03/15 23:09 UTC
Read the original article Hit count: 371

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about datetime

Related posts about vcalendar