Take this:
DateTime.Date(unix_time*1000)
The documentation says:
Date (Ticks As Long) As String
Returns a string representation of the date (which is stored as ticks). The date format can be set with the DateFormat keyword.
So that part returns a string representing the date.
It then uses DateTime.DateParse
, which is documented as:
DateParse (Date As String) As Long
Parses the given date string and returns its ticks representation.
Taken together, this appears to take the ticks, multiplied by 1000, converted to a string that doesn't contain hour information which is parsed back to ticks which are divided by 1000.
The important thing to note is that the DateFormat
set on the line before contains only the formatting for the date, no hours/minutes/seconds and smaller units of time exist in it. This means that the string returned essentially represents midnight of that date.