C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




.Net performance Tips


Posted Date: 21 May 2008    Resource Type: Tips    Category: Web Development
Author: revathiMember Level: Silver    
Rating: Points: 3



DateTime.now() method is commonly used to get the current time.
The value returned by the Now() method is in the current time-zone context.
A common practice is to convert time that is going to be stored or sent between machines into universal time(UTC).

This can introduce bugs when daylight savings time is a possibility.

For ex: DateTime date=DateTime.now().ToUniversalTime();

The value that results from the above code will be off by an hour if called during the extra hour that occurs during the daylight savings time switch in the fall.

To fix this bug, use DateTime.UtcNow() instead of calling DateTime.Now() and then converting it to universal time.

DateTime date=DateTime.UtcNow();

This will always have the 24 –hour-day perspective, and may then be safely converted to local time.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Maximum Capacity for SQL Server 2005 Database Engine object
Previous Resource: .NET Performance Tips
Return to Discussion Resource Index
Post New Resource
Category: Web Development


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use