Closed sdacalor closed 3 years ago
Hi Steeve without the context I am not sure at what point you are getting this error but this could be due to the date format.
for example consider this:
US date format - M/d/yyyy
whereas UK uses dd/MM/yyyy
if its a one off you can parse the format this way:
[datetime]::ParseExact('28/02/2020 11:12:15', 'dd/MM/yyyy hh:mm:ss', $null)
I have similar issues. I managed to purge some date/time pattern within the string using regex to overcome the issue. Still have some issue while detection the type of type within a string. Can not understand the powershell code you use to identify the type de data.
@oolejniczak - the only type of data we try to infer from string is datetime
because its the most common type within a string and even that can result in mismatch sometimes.
We cannot do that for other well known types or custom types because the only person(s) who would know the type of data they are dealing with are the people who use it so the onus is on the user to make sure that data with proper type is being sent to the database.
closing since there is no new comment.
Hi Kiran,
Incredible. An object with datetime 28/02/2020 11:12:15, cannot be convert into BsonDate, line 3, position 28. May be this come from LiteDB.
Error Could not convert string to DateTime. Path BsonDate, line 3, position 28.
Any idea !