请问,我在DateTimePicker中选择了日期是“2005-1-1”,
怎样能把它的格式改写为“2005-01-01”呢?

解决方案 »

  1.   

    fromat(DateTimePicker.date,"yyyy-mm-dd")
      

  2.   

    formatDateTime('yyyy-mm-dd', DateTimePicker1.date);
    不行?肯定是搂住搞错了参考 TFormatSettings 类型。
      

  3.   

    DateTimePicker1.Format := 'yyyy-MM-dd';
      

  4.   

    还有一个问题,现在我的DateTimePicker已经可以显示成“2004-01-01”了,可是我把它DateToStr(DateTimePicker.Date)后,存到数据库中,为什么数据中的数据显示的还是“2004-1-1”呢
      

  5.   

    两个MM要大写
    fromat(DateTimePicker.date,"yyyy-MM-dd");