Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a DateTime object?

Tags:

c#

.net

datetime

I have three integers: Hours, Minutes, and Seconds.

I want to create a DateTime object with System.Date and Time provided by the above three variables.

like image 604
pramod Avatar asked Apr 07 '11 09:04

pramod


1 Answers

Check out MSDN and have a look at the constructors that exists for DateTime, you'll find out that this is possible:

var theDate = new DateTime (DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, hours, minute, second);
like image 165
Frederik Gheysels Avatar answered Sep 29 '22 13:09

Frederik Gheysels