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 !






Get the System Date , using c#


Posted Date: 25 Apr 2008    Resource Type: Code Snippets    Category: Date & Time

Posted By: Suresh       Member Level: Silver
Rating:     Points: 7



The following code can be used to get the system date from the local computer, using c# code.
The display mode can be customised using ToShortDateString(), ToLongDateString(), ToShortTimeString(), ToLongTimeString() methods.


private void display_date()
{

string dt;
DateTime date = DateTime.Now; // display format: 4/25/2008 11:45:44 AM
dt = date.ToLongDateString(); // display format: Friday, April 25, 2008
dt = date.ToShortDateString(); // display format: 4/25/2008
dt = date.ToShortTimeString(); // display format: 11:45 AM
dt = date.ToLongTimeString(); // display format: 11:45:44 AM
}







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: Sql Function for Finding First Day of a Quarter
Previous Resource: Comparing and Adding Dates
Return to Discussion Resource Index
Post New Resource
Category: Date & Time


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

conference call

Contact Us    Privacy Policy    Terms Of Use