Add 1 Minute (clock scan)

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Add 1 Minute (clock scan)

  • Creator
    Topic
  • #50806

    Does anyone have a clever or simple way to add one minute to a date/time stamp? I started writing a script to do this, but quickly realized that you’d have to check the minutes, hours, days, months, and years! (Ex. 20091231235959).

    -- Max Drown (Infor)

Viewing 2 reply threads
  • Author
    Replies
    • #67591

      Answered my own question. The “clock scan” command is powerful!!

      Code:

      set time “20091231 235959”
      set format “%Y%m%d%H%M%S”
      set time [clock format [clock scan “+1 minute” -base [clock scan $time]] -format $format]

      -- Max Drown (Infor)

    • #67592
      Robert Kersemakers
      Participant

        Those are the best answers, aren’t they?  ðŸ˜‰

        Just remember to include the current timezone in your $time. It could prevent problems when switching from/to Daylight Saving Time. Very slim chance at that happening, but…

        Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

      • #67593
        Charlie Bursell
        Participant

          You could always add the flag -gmt 1 and do all of your time in GMT  ðŸ™‚

          You are correct the clock command is very powerful.  It will do things like yesterday, 3 days ago, next week, ecen fortnight,

      Viewing 2 reply threads
      • The forum ‘Cloverleaf’ is closed to new topics and replies.