Can anyone clear my concepts of IsDaylightSavingTime() function of DateTime in C#. I am really confused about it. I want to ask exactly what is the need and use of this function?
Thanx
Can anyone clear my concepts of IsDaylightSavingTime() function of DateTime in C#. I am really confused about it. I want to ask exactly what is the need and use of this function?
Thanx
By Referring to this link http://msdn.microsoft.com/en-us/library/htc4xefd.aspx, you will get some idea about this.
i didn't wanted to ask its code but the need of this function? And how it calculates that is it the daylight saving hour or not because every region has different daylight saving period (i.e. at some places it is observed in summer and some places in spring) and they doesn't observe it whole year. Is it calculated by the system time? I am really confused about it
If you are given two DateTimes you might need to adjust one (or both) if it is Daylight savings time if you wish to accurately calculate the TimeSpan between them.
All the rules for daylight savings time are contained within the libraries that are used to figure out what time it is on the system. Since you set your region in Windows itself, it knows which rules to use to figure out if it needs to make the adjustment or not. When the rules change Microsoft patches the time code to include the new rules. I don't know if you noticed, but the documentation references the fact that it only has the current rule, so checking in the past for daylight savings time might be wrong if the rule has changed.
Thanks It is pretty much clear now :)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.