Date datatype also stores the time
we have an unexpected behavior with date variables. (PB 12.1 Classic, Build 6807)
Here a simple example:
ld_today = Today()
MessageBox (“Value”, string (ld_today, “dd.mm.yyyy hh:mm:ss”))
The MessageBox shows a date with time. (not 00:00:00 as expected)
If I set the value in a datawindow column of type datetime the time is also included.
This is contrary to information in the help.
“The date, including the full year (1000 to 3000), the number of the month (01 to 12), and the day (01 to 31).”
Nothing about time here.
“Return values: Date
Usage: Although the datatype of the Today function is date, it can also return the current time. This occurs when Today is used as an argument for another function and that argument allows different datatypes.“
But Today() is not an argument for another function here.
Workarounds I know:
Explicit conversion to date
ld_today = Date(Today())
or to datetime
MessageBox (“Value”, string (DateTime (ld_today), “dd.mm.yyyy hh:mm:ss”))
Both removes the time or sets it to 00:00:00.