I am trieng to get the current date and time in my website. I am using the following function to get date and time.
Response.Write( DateTime.Now.Date );
I am getting the date properly but for the time I am getting as 12:00 AM . Please someone tell me how to get the current time along with the date.
You can just use DateTime.Now
and it will give both the current date and time.
By calling the additional .Date
property, you are getting a date and time with the time portion set to midnight (as documented).