Convert local time to UTC in the .NET framework 3.0

I am developing an application. in C #, I have to translate local time to UTC, local time in the time zone, who uses in my application. included. I have to use in the .NET framework 3.0, so I can not use the TimeZoneInfo object.

Does anyone have an idea how I can do this?

Should a TimeZone be used?

thank

Maybe I can’t do this?

+3
source share
2 answers

Now I see the problem. Instead, use the following method: TimeZone.ToUniversalTime

+6
source

every time I save time in the database, I ALWAYS save UTC time

myEntity.CreateDate = DateTime.UtcNow;

Now, in 3.0 or less

http://pastebin.com/w20NRkuP

, . db .

TimeZone, Minutes UTC.

:

<asp:DropDownList ID="myDropDown" runat="server" />

myDropDown.DataSource = Helper.ListAllTimeZones();
myDropDown.DataValueField = "UtcOffsetMinutes";
myDropDown.DataTextField = "DisplayName";

myDropDown.DataBind();

:

User.OffSet = (int)myDropDown.SelectedValue;

,


, sweetie.com :

alt text

UTC, / .

0

All Articles