تحويل الوقت -ساعة -دقيقة-ثواني الى رقم اي integer
#3
ا[color="purple"]ن الحساب للزمن سواء عملية الجمع او الطرح تتبع طريقة الترتيب بتوزيع الناتج
حسب قيمتة الزمنية فأذا تعداها يضاف الى القيمة الاعلى
فكل نوع لة بداية ونهاية عددية لا يمكن تغيرها الى ان تصل الى السنوات وهنا يمكن ان يكون رقم غير محدود
ويمكن يكون قرون غير محدود
[/color]

هذا مثال لاستخدام الزمن
[صورة: picture0001q.png]

كود :
procedure TForm1.Button1Click(Sender: TObject); var fromdate, toDate: TDateTime; begin label1.Caption := IntToStr(YearsBetween(AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) + ' Years' + #$A#$D + IntToStr(MonthsBetween(AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) + ' Months' + #$A#$D + IntToStr(WeeksBetween(AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) + ' Weeks' + #$A#$D + IntToStr(DaysBetween(AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) + ' Days' + #$A#$D + IntToStr(HoursBetween(AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) + ' Hours' + #$A#$D + IntToStr(MinutesBetween(AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) + ' Minutes' + #$A#$D + IntToStr(SecondsBetween(AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) + ' Seconds' + #$A#$D + IntToStr(MilliSecondsBetween(AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) + ' MilliSeconds' + #$A#$D // + IntToStr (CompareDate (AdvDateTimePicker2.DateTime, AdvDateTimePicker1.DateTime)) ; end;


form1
كود :
object Form1: TForm1 Left = 501 Top = 119 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle Caption = 'Form1' ClientHeight = 336 ClientWidth = 481 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False Position = poDesigned OnShow = Button1Click PixelsPerInch = 96 TextHeight = 13 object label1: TLabel Left = 190 Top = 131 Width = 6 Height = 24 Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -21 Font.Name = 'Nasalization' Font.Style = [fsBold] ParentFont = False end object Label2: TLabel Left = 12 Top = 88 Width = 128 Height = 24 Caption = 'Current Date' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -21 Font.Name = 'Nasalization' Font.Style = [fsBold] ParentFont = False end object Label3: TLabel Left = 14 Top = 58 Width = 142 Height = 24 Caption = 'Previous Date' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -21 Font.Name = 'Nasalization' Font.Style = [fsBold] ParentFont = False end object Label6: TLabel Left = 0 Top = 0 Width = 481 Height = 49 Align = alTop Alignment = taCenter AutoSize = False Caption = 'SLT TT MONDE' Color = clGray Font.Charset = ANSI_CHARSET Font.Color = clWhite Font.Height = -24 Font.Name = 'Nasalization' Font.Style = [fsBold] ParentColor = False ParentFont = False Layout = tlCenter ExplicitLeft = -8 ExplicitTop = -8 end object Button1: TButton Left = 14 Top = 143 Width = 153 Height = 25 Caption = 'cALCULER' TabOrder = 0 OnClick = Button1Click end object AdvDateTimePicker1: TAdvDateTimePicker Left = 165 Top = 63 Width = 186 Height = 21 Date = 40766.870509259260000000 Format = 'dd/MM/yyyy' Time = 40766.870509259260000000 DoubleBuffered = True Kind = dkDateTime ParentDoubleBuffered = False ParentShowHint = False ShowHint = False TabOrder = 1 OnChange = Button1Click BorderStyle = bsSingle Ctl3D = True DateTime = 40766.870509259260000000 TimeFormat = 'HH:mm:ss' Version = '1.1.0.2' LabelFont.Charset = DEFAULT_CHARSET LabelFont.Color = clWindowText LabelFont.Height = -11 LabelFont.Name = 'Tahoma' LabelFont.Style = [] end object AdvDateTimePicker2: TAdvDateTimePicker Left = 165 Top = 90 Width = 186 Height = 21 Date = 40766.870509259260000000 Format = 'dd/MM/yyyy' Time = 40766.870509259260000000 DoubleBuffered = True Kind = dkDateTime ParentDoubleBuffered = False ParentShowHint = False ShowHint = False TabOrder = 2 OnChange = Button1Click BorderStyle = bsSingle Ctl3D = True DateTime = 40766.870509259260000000 TimeFormat = 'HH:mm:ss' Version = '1.1.0.2' LabelFont.Charset = DEFAULT_CHARSET LabelFont.Color = clWindowText LabelFont.Height = -11 LabelFont.Name = 'Tahoma' LabelFont.Style = [] end object XPManifest1: TXPManifest Left = 424 Top = 216 end end
الرد


الردود في هذا الموضوع
تحويل الوقت -ساعة -دقيقة-ثواني الى رقم اي integer - بواسطة cargem - 07-10-2011, 01:37 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم