Announcement

Collapse
No announcement yet.

Time variable problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Time variable problem

    Hi all

    I tested this line in events
    hs.writelog("TimeTest",hs.replacevariables("$$Time"))

    And i get this :
    Jun-25 15:52:35 TimeTest 3:52 PM

    Why is iT showing in 12h format?

    Is iT a bug?

    Regards
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

    #2
    anyone?
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

    Comment


      #3
      This will be something that HS have decided and programmed I would imagine, it is debatable whether or not it is a bug but they do not advertise that it would be in 24Hr format so I guess can't be considered one. Only HS could change it to a 24Hr one...

      Comment


        #4
        The Help file for Replacement Variables clearly defines it as 12 hour format. You could use a script to convert it to 24 hour format:

        Code:
        Sub Main(parm as object)
        Dim TimeStr as String = hs.replacevariables("$Time")
        Dim AmPm As String = Right(TimeStr, 2)
        Dim Hr As String
        Dim Min As String
        Dim HrLen as Integer = InStr(TimeStr,":") - 1
        Hr = Left(TimeStr,HrLen)
        Min = Mid(TimeStr, HrLen + 1, 3)
        
        If Hr = "12" Then Hr = "00"
        
        If AmPm = "PM" Then Hr = CInt(Hr)+12
        
        hs.writelog("TimeTest",Hr & Min)
        
        End Sub
        John

        Edit: Added line to handle hour 12.
        Last edited by jhearty; July 1, 2016, 12:10 AM.

        Comment


          #5
          And so it is - I stand corrected, I was looking at $$Time rather than $Time

          Comment

          Working...
          X