Home > Back-end > Data type conversion: string into a time type
Data type conversion: string into a time type
Time:10-24
String into a time type,
Time display control using datetimepicker, Purpose is to display the first day of a year in the datetimepicker control: Var Sdate: string;
Sdate=formatdatetime (yyyy, date);//take years, such as 2012 Sdate: sdate=+ '- 01-01';//take years and in the previous step - 01-01 is the first day of every year, such as the 2012-01-01 Datetimepicker1. Date:=strtodate (sdate);//the conversion of data types, converts a string type into time type
Runtime error is given: '2012-01-01' is not a valid date and time.
Is there a problem I do this? Where the problem?
In addition, a good way?
Please explain in detail, thanks.
CodePudding user response:
Supplement: same program under Windows XP and Windows 2003 are no problem, but in 2008 to run the error message,