:: Home     :: MS Dynamics CRM     :: .Net 1.1     :: .Net 2.0     :: Sharepoint Portal     :: Ajax


 Getting Current Date Time

In classic ASP we had now() which would return the current date and time. For asp.net this no longer exists.  So what should we use?  

Lets assign the current date to the variable taxDate

taxDate.Text = DateTime.Now

We can improve on this by adding some formatting.  In this instance we are only interested in the date, and not the time.  So we have:

taxDate.Text = DateTime.Now.ToString("dd, MMM, yyyy")

Copyright 2005-2015, Megasolutions Ltd  |   Privacy Policy