Hi,
I'm having an issue. By using the following code, i save the dateandtime to my MSSQL DB .
In the DB it saves the time as 21:.... but when I view the time using a gridview it shows 1:... (the correct time I want to show is the 1:... )Code:Dim dateTimeToConvert As New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second, Now.Minute, DateTimeKind.Utc) Dim easternTime As DateTime = TimeZoneInfo.ConvertTime(dateTimeToConvert, easternZone) Dim nowtime As DateTime = easternTime.ToUniversalTime TIMESTAMPSqlDataSource1.InsertParameters("datee").DefaultValue = nowtime TIMESTAMPSqlDataSource1.insert()
HTML Code:<form id="form1" runat="server"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /> <asp:BoundField DataField="datee" HeaderText="datee" SortExpression="datee" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnString %>" SelectCommand="SELECT [ID], [datee] FROM [timestamp] ORDER BY [ID] DESC"></asp:SqlDataSource> </form>
I'm not sure why i'm getting two different dates , any idea?
thanks




Reply With Quote