Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add a DateTimeOffset to a DateTime in C#?

Tags:

c#

datetime

i have a problem, i have a DateTimeOffset and a DateTime, and i want to know how to add the Offset to the DateTime?

DateTimeOffset e.g. is +02:00

like image 599
hansgiller Avatar asked May 24 '11 10:05

hansgiller


1 Answers

Assuming that you need to add +2:00 to a DateTime. You can do,

DateTime dateTime = DateTime.Now.AddHours(2.0);
like image 85
FIre Panda Avatar answered Sep 17 '22 12:09

FIre Panda