Combine date and time values into a merged datetime value

Is there a straight forward way to combine a value of type Date, with a value of type Time, to get the resulting datetime.

So for example if I have Date(1985, 1, 4) and Time(1, 30, 45), how would I return a datetime value at 1:30:45 on 1985/1/4?

Todatetime() is the function you are looking for

Just add them together:

image

Both date and time are actually the same data type; the only difference is that date is basically datetime with time=12AM and time is basically datetime with date=0 (31/12/1899 IIRC)

4 Likes

Not a good approach as it requires conversion from date to text and then from text to date. This is brittle as the date may get messed up due to different formatting.