Aktuelles Datum mit Änderungsdatum vergleichen

  • Hallo,

    ich möchte überprüfen, ob eine Datei schon älter als eine Woche ist. Wenn ja, soll er sich eine Datei aus dem Internet runterladen. Wie mache ich das?

    Danke im Voraus!

    Einmal editiert, zuletzt von Taek (31. Juli 2008 um 18:52)

  • Sieh dir mal die Funktion
    "FileGetTime" an,..

    Spoiler anzeigen

    There are only 10 types of people in the world:
    Those who understand binary - and those who don't.

  • Damit komm ich nicht klar. Ich bekomm einen String den ich nicht (besser gesagt: ich weiß nicht wie) mit der Systemzeit verlgeichen kann.

  • Laut Hilfe:
    Remarks:
    The array is a single dimension array containing six elements:
    $array[0] = year (four digits)
    $array[1] = month (range 01 - 12)
    $array[2] = day (range 01 - 31)
    $array[3] = hour (range 00 - 23)
    $array[4] = min (range 00 - 59)
    $array[5] = sec (range 00 - 59)
    Notice that return values are zero-padded.

    Damit lässt sich doch was anfangen ?
    rechnest das gesamt in Tage um, also
    $Tage_neu = (@Year-1) * 365 + @Yday
    $Tage_alt = ($array[0]-1) * 365 + ($array[1]-1) * 30 + $array[2]

    Oder etwa nicht ? :P
    und dann halt:
    If $Tage_neu - 7 > $Tage_alt Then MsgBox( 0, '', 'älter als 1 Woche' )

    There are only 10 types of people in the world:
    Those who understand binary - and those who don't.

  • So gings auch :)

    Spoiler anzeigen
    [autoit]

    #include <date.au3>
    $FileCalcDate = FileGetTime("C:\datei.ext", 0, 1)
    $FileCalcDate = _FileDateString2Calc($FileCalcDate)
    $diff = _DateDiff("D",$FileCalcDate,_NowCalc())
    ; Author(s): Prog@ndy
    Func _FileDateString2Calc($filedate)
    Return StringRegExpReplace($filedate, "(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})", "$1/$2/$3 $4:$5:$6")
    EndFunc ;==>_FileDateString2Calc

    [/autoit]
  • Oder so ^^
    Ist aber mehr Code ;)

    Edit: Danke x) Ich versuche StringRegExp möglichst zu vermeiden, diese Funktionen sind mir nicht geheuer xD

    There are only 10 types of people in the world:
    Those who understand binary - and those who don't.