Julain Date formatting

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Julain Date formatting

  • Creator
    Topic
  • #54159
    gricelda lopez
    Participant

    Hello

    I am trying to format a header line for a output file. I am using tcl code for this job. I have an if statement where it checks the Julian day and if it

Viewing 3 reply threads
  • Author
    Replies
    • #80382
      bill bearden
      Participant

      Hello Gricelda,

      I think clock format isn’t expecting a Julian date.

      If juldt_int has a Julian date in it, try changing this line near the end of your script

       set juldt_str [clock format $juldt_int -format “%Y%m%d”]

      to something like

       set juldt_str [clock format [clock scan $juldt_int -format “%J”] -format “%Y%m%d”]

      Good luck

    • #80383
      gricelda lopez
      Participant

      Hi Bill,

      I tried your suggestion and it still didn’t work. I got the below error message:

      [0:TEST] Tcl error:

      msgId = message0

      proc = ‘tps_northern_trust’

      args = ”

      result = ‘bad switch “-format”: must be -base or -gmt’

      errorInfo: ‘

      bad switch “-format”: must be -base or -gmt

         while executing

      “clock scan $juldt_int -format “%j””

      thank you 🙂

    • #80384
      gricelda lopez
      Participant

      I found another way to add the days. Instead of using the julian date I am just adding days to my IF statement. So far it works, I will need to test it out a little more using different dates but so far so good.

    • #80385
      Tom Rioux
      Participant

      Gricelda,

      Try something like this:

      (Using the given date of today = 20140416.   Adjust to how you need it)

      set julian_dt [clock format [clock seconds] -format “%j”]

      set day_of_wk [clock format [clock seconds] -format “%a”]

      if {[string equal $day_of_wk “FRI”]} {

          set future_dt [clock scan “$julian_dt 2 day”]

      } else if { …..(continue with rest of code

      }

      set new_date [clock format $future_dt -format %Y%m%d]

      Hope this works for you!

      Tom Rioux

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

Forum Statistics

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