Forum Discussion

notKeith_109250's avatar
notKeith_109250
Icon for Nimbostratus rankNimbostratus
Nov 06, 2014

Once I've set the current day, I need to manipulate it

This gives me a current date value:

 

set current_day [clock format [clock seconds] -format {%j} ] set current_time [clock seconds]

 

The problem for me here is I need local time. The F5 server is on UTC, but the server is CST. How can I generate a variable that basically says current_day {all that stuff} - 6 hours? And likewise set current_time [clock seconds] - 6 hours? Is this possible?

 

2 Replies

  • R_Eastman_13667's avatar
    R_Eastman_13667
    Historic F5 Account

    Try this:

    set currentTime [clock format [clock seconds] -format {%m%d%Y%H:%M:%S}]
    set todaysDate [clock format [clocks seconds] -format {%Y-%m-%d}]
    log local0. "Today's date is: ${todaysDate} and time is: ${currentTime}"
    
    • notKeith_109250's avatar
      notKeith_109250
      Icon for Nimbostratus rankNimbostratus
      Hi, R Eastman - that doesn't solve my problem - the F5 is UTC - the result of this code shows today's date and time, still UTC. I'm looking for some conversion that in effect says here is the UTC time - (maybe in epoch time?) - now subtract 5 or 6 hours (depending) and use THAT value to populate todaysDate and currentTime.. still looking.