'23/02/2011 12:34:56' is not valid date and time

前端 未结 3 769
半阙折子戏
半阙折子戏 2020-12-16 12:59

In my code I am facing a problem. Example code:

var 
    d1: tdatetime
begin
    d1 := strtodatetime(\'23/02/2011 12:34:56\');
end; 

but it

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 13:37

    Using VarToDateTime might be a lot simpler and it just works out of the box:

    uses Variants;
    
    newDateTime := VarToDateTime('23/02/2011 12:34:56');
    

提交回复
热议问题