Announcement

Collapse
No announcement yet.

Compare dates

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • claus707
    replied
    Slota,
    Thank you so much man!
    You made my day

    Leave a comment:


  • slota
    replied
    Code:
    [font=Courier New][size=2]Date_ToJuliandate [color=#FF0000]=[/color] [color=#0000FF][b]function[/b][/color] (nYear[color=#FF0000],[/color] nMonth[color=#FF0000],[/color] nDay)
        [color=#0000FF][b]if[/b][/color] (nMonth [color=#FF0000]<[/color] 3) [color=#0000FF][b]then[/b][/color] nMonth [color=#FF0000]=[/color] nMonth [color=#FF0000]+[/color] 12; nYear [color=#FF0000]=[/color] nYear [color=#FF0000]-[/color] 1; [color=#0000FF][b]end[/b][/color]
        [color=#0000FF][b]local[/b][/color] nA [color=#FF0000]=[/color] Math[color=#FF0000].[/color]Floor(nYear [color=#FF0000]/[/color] 100);
        [color=#0000FF][b]local[/b][/color] nB [color=#FF0000]=[/color] Math[color=#FF0000].[/color]Floor(nA [color=#FF0000]/[/color] 4);
        [color=#0000FF][b]local[/b][/color] nC [color=#FF0000]=[/color] 2 [color=#FF0000]-[/color] nA [color=#FF0000]+[/color] nB;
        [color=#0000FF][b]local[/b][/color] nE [color=#FF0000]=[/color] Math[color=#FF0000].[/color]Floor(1461 [color=#FF0000]*[/color] (nYear [color=#FF0000]+[/color] 4716) [color=#FF0000]/[/color] 4);
        [color=#0000FF][b]local[/b][/color] nF [color=#FF0000]=[/color] Math[color=#FF0000].[/color]Floor(153 [color=#FF0000]*[/color] (nMonth [color=#FF0000]+[/color] 1) [color=#FF0000]/[/color] 5);
        [color=#0000FF][b]return[/b][/color] (nC [color=#FF0000]+[/color] nDay [color=#FF0000]+[/color] nE [color=#FF0000]+[/color] nF [color=#FF0000]-[/color] 1524.5);
    [color=#0000FF][b]end[/b][/color]
    
    [color=#008000][i]--local data_object_1 = DateTimePicker.GetDateTimeStr("data1");[/i][/color]
    [color=#008000][i]--local data_object_2 = DateTimePicker.GetDateTimeStr("data2");[/i][/color]
    
    [color=#0000FF][b]local[/b][/color] data_object_1 [color=#FF0000]=[/color] [color=#800080]'2012-12-28'[/color];
    [color=#0000FF][b]local[/b][/color] data_object_2 [color=#FF0000]=[/color] [color=#800080]'2013-12-25'[/color];
    
    [color=#0000FF][b]local[/b][/color] tDataOne [color=#FF0000]=[/color] [color=#FF0000]{[/color][color=#FF0000]}[/color];
    tDataOne[color=#FF0000].[/color]Year  [color=#FF0000]=[/color] tonumber(String[color=#FF0000].[/color]Mid(data_object_1[color=#FF0000],[/color] 1[color=#FF0000],[/color] 4));
    tDataOne[color=#FF0000].[/color]Month [color=#FF0000]=[/color] tonumber(String[color=#FF0000].[/color]Mid(data_object_1[color=#FF0000],[/color] 6[color=#FF0000],[/color] 2));
    tDataOne[color=#FF0000].[/color]Day   [color=#FF0000]=[/color] tonumber(String[color=#FF0000].[/color]Mid(data_object_1[color=#FF0000],[/color] 9[color=#FF0000],[/color] 2));
    
    [color=#0000FF][b]local[/b][/color] tDataTwo [color=#FF0000]=[/color] [color=#FF0000]{[/color][color=#FF0000]}[/color];
    tDataTwo[color=#FF0000].[/color]Year  [color=#FF0000]=[/color] tonumber(String[color=#FF0000].[/color]Mid(data_object_2[color=#FF0000],[/color] 1[color=#FF0000],[/color] 4));
    tDataTwo[color=#FF0000].[/color]Month [color=#FF0000]=[/color] tonumber(String[color=#FF0000].[/color]Mid(data_object_2[color=#FF0000],[/color] 6[color=#FF0000],[/color] 2));
    tDataTwo[color=#FF0000].[/color]Day   [color=#FF0000]=[/color] tonumber(String[color=#FF0000].[/color]Mid(data_object_2[color=#FF0000],[/color] 9[color=#FF0000],[/color] 2));
    
    [color=#0000FF][b]if[/b][/color] (Date_ToJuliandate(tDataTwo[color=#FF0000].[/color]Year[color=#FF0000],[/color] tDataTwo[color=#FF0000].[/color]Month[color=#FF0000],[/color] tDataTwo[color=#FF0000].[/color]Day) [color=#FF0000]>[/color][color=#FF0000]=[/color] Date_ToJuliandate(tDataOne[color=#FF0000].[/color]Year[color=#FF0000],[/color] tDataOne[color=#FF0000].[/color]Month[color=#FF0000],[/color] tDataOne[color=#FF0000].[/color]Day)) [color=#0000FF][b]then[/b][/color]
        Dialog[color=#FF0000].[/color]Message([color=#800080]"Notice"[/color][color=#FF0000],[/color] [color=#800080]"Your message here."[/color][color=#FF0000],[/color] MB_OK[color=#FF0000],[/color] MB_ICONINFORMATION[color=#FF0000],[/color] MB_DEFBUTTON1);
    [color=#0000FF][b]end[/b][/color][/size][/font]

    Leave a comment:


  • claus707
    started a topic Compare dates

    Compare dates

    Hello to everyone,
    I have two DateTimePicker plugins in my project the date format of them is:
    "yyyy-MM-dd"
    My problem is that I want to compare the date that is read from object one with the date that is read from the object two. In my case I want that data_object_2 to be >= data_object_1.

    data_object_1 = DateTimePicker.GetDateTimeStr("data1");
    data_object_2 = DateTimePicker.GetDateTimeStr("data2");
Working...
X