学习官方示例 - SysUtils.EncodeDate、EncodeTime、StrToDate、StrToTime、StrToDateTime
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                学习官方示例 - SysUtils.EncodeDate、EncodeTime、StrToDate、StrToTime、StrToDateTime
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.                        
                                代碼文件:
unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;typeTForm1 = class(TForm)ListBox1: TListBox;Button1: TButton;Button2: TButton;procedure Button1Click(Sender: TObject);procedure Button2Click(Sender: TObject);end;varForm1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject); varD: TDate;T: TTime; beginD := EncodeDate(2008, 9, 11);T := EncodeTime(14, 56, 12, 1);ListBox1.Clear;ListBox1.Items.Add(FormatDateTime('yyyy/mm/dd', D));ListBox1.Items.Add(FormatDateTime('hh:nn:ss:zzz', T)); end;procedure TForm1.Button2Click(Sender: TObject); varD: TDate;T: TTime;DT: TDateTime; beginD := StrToDate('2008-9-11');T := StrToTime('14:56:06');DT := StrToDateTime('2008-9-11 14:56:06');ListBox1.Clear;ListBox1.Items.Add(DateToStr(D));ListBox1.Items.Add(TimeToStr(T));ListBox1.Items.Add(DateTimeToStr(DT)); end;end.
窗體文件:
object Form1: TForm1Left = 0Top = 0Caption = 'Form1'ClientHeight = 93ClientWidth = 249Color = clBtnFaceFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -11Font.Name = 'Tahoma'Font.Style = []OldCreateOrder = FalsePixelsPerInch = 96TextHeight = 13object Button1: TButtonLeft = 158Top = 14Width = 75Height = 25Caption = 'Button1'TabOrder = 0OnClick = Button1Clickendobject ListBox1: TListBoxLeft = 0Top = 0Width = 145Height = 93Align = alLeftItemHeight = 13TabOrder = 1ExplicitHeight = 206endobject Button2: TButtonLeft = 158Top = 53Width = 75Height = 25Caption = 'Button2'TabOrder = 2OnClick = Button2Clickend end
轉(zhuǎn)載于:https://www.cnblogs.com/del/archive/2008/09/11/1289203.html
總結(jié)
以上是生活随笔為你收集整理的学习官方示例 - SysUtils.EncodeDate、EncodeTime、StrToDate、StrToTime、StrToDateTime的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: [ SAP ASAP ] SAP ASA
- 下一篇: 从一个C程序学“逐步求精”的分析方法
