dateTime.picker uses Integer rather than Double value

Not sure if this is a bug, feature or as expected, but it had me confused for a few hours where some code wasn’t working as expected.

If I get a dateTime - e.g. from a folderItem.createdDate - it will often include decimal places in the secondsFrom1970.

Placing that dateTime into a DateTimePicker.selectedDate will use the integer value of the dateTime.seconds and may show the second prior to the rounded value of secondsFrom1970.

Some code:

Var secs As Double = 1691357607.77 //should round up to 16:33:28
Var dt As New datetime(secs)
tf1.Text = secs.ToString("#####################.###")
dtp1.SelectedDate = New datetime(secs) //displays as 16:33:27
tf2.Text = dt.SecondsFrom1970.ToString("#####################.###")
tf3.Text = dtp1.selectedDate.SecondsFrom1970.ToString("#####################.###")

This can cause unexpected results e.g. if searching for files within a particular range.

The solution is to always use round, ceiling or floor functions to ensure the full range is captured e.g.:

var dt as New dateTime(ceiling(secs))`

Maybe related:
#73474 - Sub classing DateTime loses the Nanosecond value