Best practice for DateTime <--> DateTimeOffset

1.8k Views Asked by At

Right now in my code I have the following:

cfg.CreateMap<DateTimeOffset, DateTime>().ConstructUsing(x => x.UtcDateTime);
cfg.CreateMap<DateTime, DateTimeOffset>().ConstructUsing(x => new DateTimeOffset(x));

To say the least, this feels like a hack/kludge. Is there a better and/or more standard way to do this?

Thanks in advance!

0

There are 0 best solutions below