我有一個SQL內置的SQL有2個參數,一個是年份,另一個是月份。TDateTimePicker delphi獲取年份和月份
在delphi中,我在框架上添加了一個TDateTimePicker,以便讓用戶選擇月份和年份。
如何從TDateTimePicker中檢索Year/Day的值?
我試過DateTimePicker2.Date;
但是這給了我一個日期格式 「XX/XX/XXXX」
我想要得到的實際年/月
像
int year ;
year := DateTimePicker2.Date.Year;
有什麼辦法可以做到這一點?
使用['YearOf'](http://docwiki.embarcadero.com/Libraries/XE6/en/System.DateUtils.YearOf)和['MonthOf'](http: //docwiki.embarcadero.com/Libraries/XE6/en/System.DateUtils.MonthOf)函數。或者['DecodeDate'](http://docwiki.embarcadero.com/Libraries/XE6/en/SystemUtils.DecodeDate)立即獲取它們。 – TLama
謝謝,先生!我知道有這樣做的功能,但我找不到它們。 – CiucaS
你想讓這個答案@TLama? –