2021年1月29日星期五

VB.NET CDate lops off 12:00:00 AM from 1/19/2021 12:00:00 AM

We ran into something curious with CDate and a datetime strings with midnight as the time.

When we pass in non-midnight datetimes we get

CDate("1/18/2021 9:00:00 PM") returns #1/18/2021 9:00:00 PM#

CDate("1/19/2021 12:01:00 AM") returns #1/19/2021 12:01:00 AM#

These are both expected results.

However when we pass in:

CDate("1/19/2021 12:00:00 AM") it only returns #1/19/2021# without the time portion.

Is there any reason why time is omitted?

https://stackoverflow.com/questions/65962899/vb-net-cdate-lops-off-120000-am-from-1-19-2021-120000-am January 30, 2021 at 07:07AM

没有评论:

发表评论