Adding days to date message recieved using system time tcl

Homepage Clovertech Forums Cloverleaf Adding days to date message recieved using system time tcl

  • Creator
    Topic
  • #117662
    Hannah Ndungu
    Participant

    I am trying to add days to the day the message was received, using system time.  Any ideas on how to code for this?

Viewing 2 reply threads
  • Author
    Replies
    • #117663
      Tipu Razaq
      Participant

      <p>What do you mean? Are you trying to add more time to a date/time field in the message? </p>

    • #117664
      Hannah Ndungu
      Participant

      Correct! Say date and time of message was 20200817142811. I would like to add 11 days to that using system time as opposed to MSH 7

      • #117678
        Tipu Razaq
        Participant

        Here’s the TCL command. Takes your date/time, converts it to seconds, adds 11 days, converts it back to your desired date format of %Y%m%d%H%M%S (year, month, day, hour, minutes, seconds)

        This is all assuming 24 hour clocks, not 12 hr

         

        clock format [clock add [clock scan 20200817142811 -format %Y%m%d%H%M%S] 11 days] -format %Y%m%d%H%M%S

         

        New date/time: 20200828142811

      • #117682
        Hannah Ndungu
        Participant

        Thank you

    • #117665
      Vince Angulo
      Participant

      I just tried this at the tcl prompt to get 3 days in the future, you can probably google better examples of clock scan to fit your exact needs:

      clock format [clock scan “72 hours”] -format %Y%m%d%H%M%S
      20200821122548

      • This reply was modified 4 years, 2 months ago by Vince Angulo.
      • This reply was modified 4 years, 2 months ago by Vince Angulo.
Viewing 2 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,129
Forums
28
Topics
9,301
Replies
34,447
Topic Tags
288
Empty Topic Tags
10