Difference between DateTime and Timespan?

I can do anything I need with DateTime, is Timespan some kind of a shortcut. I know it returns the same thing as Date. Anyone got an explanation?

1 Like

Hey there, my guess is that DateTime is used to hold full dates and Timespan is used to hold a chunk of time. From a DateTime you can only add TimeSpans and not DateTimes. So i would say it’s better to use Timespans if you want to add or subtract a chunk of time from a specific date using DateTime.

1 Like

I figured it out. Timespan can get you total things. For example if you have 30 days, you can get them in minutes, seconds etc. DateTime can do the same thing, but unlike DateTime, Timespan can convert time units pretty easily, going from minutets to years and vice versa. At least that’s what I got from some testing.

Tx for the insight nonetheless.

1 Like

FDateTime stores a date and time, i.e. a point in time on a calendar and wall clock.

FTimespan stores a duration.

The difference between two FDateTime values is an FTimespan.

3 Likes

Thank you thats a great explanation