读书人

如何从DateTimePicker1-gt;DateTime分离

发布时间: 2012-02-23 22:01:34 作者: rapoo

怎么从DateTimePicker1->DateTime分离年月日
怎样从DateTimePicker1->DateTime分离出年月日?

[解决办法]
用DecodeDate方法
http://www.delphitop.com/html/shijian/308.html
[解决办法]

C/C++ code
      unsigned short year,month,day;      DateTimePicker1->Date.DecodeDate(&year,&month,&day);      ShowMessage(year);      ShowMessage(month);      ShowMessage(day);
[解决办法]
1楼的提示已足够,就用DecodeDate方法。
[解决办法]
Year=FormatDateTime("YYYY",DateTimePicker1->DateTime);
Month=FormatDateTime("MM",DateTimePicker1->DateTime);
Day=FormatDateTime("DD",DateTimePicker1->DateTime);

读书人网 >C++ Builder

热点推荐