如何将格式yyyy.mm.dd转化为yyyymmdd谢谢

解决方案 »

  1.   

    showmessage(formatdatetime('yyyymmdd',now));
      

  2.   

    procedure TForm1.SpeedButton1Click(Sender: TObject);
    begin
     Edit1.Text:=FormatDateTime('yyyymmdd',date);
    end;
      

  3.   

    date:=yourdate;
    FormatDateTime('yyyymmdd',date);
      

  4.   

    来晚了,说一个笨方法
    'yyyymmdd':=copy('yyyy.mm.dd',1,4)+copy('yyyy.mm.dd',6,2)+copy('yyyy.mm.dd',9,2)
      

  5.   

    XuDunYu(西门吹雪) :我真佩服你,连这样的方法都能想得出来。
    没话说!!
      

  6.   

    靠来晚了 ~~
    贴个DELPHI帮助
    UnitSysUtilsCategorydatetime routinesDelphi syntax:function FormatDateTime(const Format: string; DateTime: TDateTime): string; overload;
    function FormatDateTime(const Format: string; DateTime: TDateTime; const FormatSettings: TFormatSettings): string; overload;C++ syntax:extern PACKAGE AnsiString __fastcall FormatDateTime(const AnsiString Format, System::
    TDateTime DateTime);
    extern PACKAGE AnsiString __fastcall FormatDateTime(const AnsiString Format, System::
    TDateTime DateTime, const TFormatSettings FormatSettings);DescriptionFormatDateTime formats the TDateTime value given by DateTime using the format given by Format. See Date-Time format strings for more information.If the string specified by the Format parameter is empty, the TDateTime value is formatted as if a 'c' format specifier had been given.The first form of FormatDateTime is not thread-safe, because it uses localization information contained in global variables. The second form of FormatDateTime, which is thread-safe, refers to localization information contained in the FormatSettings parameter. Before calling the thread-safe form of FormatDateTime, you must populate FormatSettings with localization information. To populate FormatSettings with a set of default locale values, call GetLocaleFormatSettings.
    厚着脸接分