M
Marc Pelletier
Hello,
I am writing an application that does some simple astronomical
calculations. One of the variables I need is the number of hours passed in
this year. I've written the following function
public static double GetHoursofYear( DateTime aTime )
{
DateTime StartYear = new DateTime( aTime.Year, 1, 1 );
return ( aTime.ToOADate() - StartYear.ToOADate() ) * 24;
}
I would expect this function to adapt to daylight savings time but it
doesn't. I'm in Saskatchewan where we don't change, but if I change my
system time zone to Eastern, where they do change I get the same value back
for a given date and time.
In fact I don't want my app to make the adjustment automatically, but I
don't understand why it doesn't!
Thanks for any insight.
Marc Pelletier
I am writing an application that does some simple astronomical
calculations. One of the variables I need is the number of hours passed in
this year. I've written the following function
public static double GetHoursofYear( DateTime aTime )
{
DateTime StartYear = new DateTime( aTime.Year, 1, 1 );
return ( aTime.ToOADate() - StartYear.ToOADate() ) * 24;
}
I would expect this function to adapt to daylight savings time but it
doesn't. I'm in Saskatchewan where we don't change, but if I change my
system time zone to Eastern, where they do change I get the same value back
for a given date and time.
In fact I don't want my app to make the adjustment automatically, but I
don't understand why it doesn't!
Thanks for any insight.
Marc Pelletier