Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Working with dates and times

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
K Viltersten - 16 Mar 2008 16:47 GMT
Is there a good handling tool for dates in
C#? I'd like to get my hands on something
that will help me compute e.g. number of
minutes between point A and B in time BUT
also will regard things as leap years,
daylight savings etc. within a range of
a decade.

Is there something like that already or
will i have to write it myself?

--
Regards
Konrad Viltersten
--------------------------------
sleep    - a substitute for coffee for the poor
ambition - lack of sense to be lazy
Jon Skeet [C# MVP] - 16 Mar 2008 16:41 GMT
> Is there a good handling tool for dates in
> C#? I'd like to get my hands on something
[quoted text clipped - 6 lines]
> Is there something like that already or
> will i have to write it myself?

DateTime and DateTimeOffset (.NET 2.0SP1) do quite a lot of this, but
you do need to be careful when it comes to timezones etc.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

K Viltersten - 16 Mar 2008 17:16 GMT
>> Is there a good handling tool for dates in
>> C#? I'd like to get my hands on something
[quoted text clipped - 10 lines]
> do quite a lot of this, but you do need to
> be careful when it comes to timezones etc.

Luckily, i'll be developing for one, single
time zone, so that issue is gone. I hope
that the rest is coded well so i won't have
to be surprised by one of the many gotchas
there are in our calendar system.

Thanks.

--
Regards
Konrad Viltersten
--------------------------------
sleep    - a substitute for coffee for the poor
ambition - lack of sense to be lazy
Arne Vajhøj - 17 Mar 2008 00:35 GMT
> Is there a good handling tool for dates in
> C#? I'd like to get my hands on something that will help me compute e.g.
> number of
> minutes between point A and B in time BUT
> also will regard things as leap years, daylight savings etc. within a
> range of a decade.

If A and B are DateTime then you can just use (B-A).TotalMinutes !

You can always get burned by sufficient complex logic with
timezones, DST and changes.

Arne

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.