P
pamela fluente
Hi friend, take the following simple code (vb or c#)
It raises the exception:
The supplied DateTime represents an invalid time. For example,
when the clock is adjusted forward, any time in the period that is
skipped is invalid.
Parameter name: dateTime
Could i have some enlightening on this? (should be related with
daylight)
And how should i modify my loop to proceed normally in the generation
of new dates avoiding the error ?
[BTW i am generating time series of random prices, this is time, the
"x" axis]
-Pam
-----------------------------------------------
Public TimeZoneInfo_LOCAL As TimeZoneInfo = TimeZoneInfo.Local
Public TimeZoneInfo_EDT As TimeZoneInfo =
TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim d As New Date(Now.Year, Now.Month, Now.Day)
Do
Dim NewDate = d.AddMinutes(-1)
Dim NewDate_EDT As Date =
TimeZoneInfo.ConvertTime(NewDate, TimeZoneInfo_EDT,
TimeZoneInfo_LOCAL)
d = NewDate
Loop
End Sub
-----------------------------------------------
-----------------------------------------------
public TimeZoneInfo TimeZoneInfo_LOCAL = TimeZoneInfo.Local;
public TimeZoneInfo TimeZoneInfo_EDT =
TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
private void Button1_Click(System.Object sender, System.EventArgs e)
{
System.DateTime d = new System.DateTime(DateAndTime.Now.Year,
DateAndTime.Now.Month, DateAndTime.Now.Day);
do {
dynamic NewDate = d.AddMinutes(-1);
System.DateTime NewDate_EDT = TimeZoneInfo.ConvertTime(NewDate,
TimeZoneInfo_EDT, TimeZoneInfo_LOCAL);
d = NewDate;
} while (true);
}
-----------------------------------------------
It raises the exception:
The supplied DateTime represents an invalid time. For example,
when the clock is adjusted forward, any time in the period that is
skipped is invalid.
Parameter name: dateTime
Could i have some enlightening on this? (should be related with
daylight)
And how should i modify my loop to proceed normally in the generation
of new dates avoiding the error ?
[BTW i am generating time series of random prices, this is time, the
"x" axis]
-Pam
-----------------------------------------------
Public TimeZoneInfo_LOCAL As TimeZoneInfo = TimeZoneInfo.Local
Public TimeZoneInfo_EDT As TimeZoneInfo =
TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim d As New Date(Now.Year, Now.Month, Now.Day)
Do
Dim NewDate = d.AddMinutes(-1)
Dim NewDate_EDT As Date =
TimeZoneInfo.ConvertTime(NewDate, TimeZoneInfo_EDT,
TimeZoneInfo_LOCAL)
d = NewDate
Loop
End Sub
-----------------------------------------------
-----------------------------------------------
public TimeZoneInfo TimeZoneInfo_LOCAL = TimeZoneInfo.Local;
public TimeZoneInfo TimeZoneInfo_EDT =
TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
private void Button1_Click(System.Object sender, System.EventArgs e)
{
System.DateTime d = new System.DateTime(DateAndTime.Now.Year,
DateAndTime.Now.Month, DateAndTime.Now.Day);
do {
dynamic NewDate = d.AddMinutes(-1);
System.DateTime NewDate_EDT = TimeZoneInfo.ConvertTime(NewDate,
TimeZoneInfo_EDT, TimeZoneInfo_LOCAL);
d = NewDate;
} while (true);
}
-----------------------------------------------