Announcement

Collapse
No announcement yet.

Strange thing - with culture info in a vbscript oneline I get a reboot of HS3!?

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

    Strange thing - with culture info in a vbscript oneline I get a reboot of HS3!?

    So I have this line of code:

    Code:
    &hs.setDeviceString(592,DateTime.parse(FormatDateTime(cstr(hs.GetVar("gv_tod_vacation_from")))),False)
    That works just great, however I get an US date in return, and I would like to get it into Swedish, some googling suggested something like:

    Code:
    &hs.setDeviceString(592,DateTime.parse(FormatDateTime(cstr(hs.GetVar("gv_tod_vacation_from")))),System.Globalization.CultureInfo.GetCultureInfo("sv-SE"))
    And then HS3 reboots everytime I trigger this. Someone might be able to tell me what I am doing wrong here?

    Purpose: Update a device with the datepart (into YYYY-MM-DD) from a global variable (which keeps a DateTime value with US standard, ex. "26/12/2019 23:59:59" - so I would like "2019-12-26" (don't need the time at all - it is just for display on ImperHome screen for status kind of thing)). In this case the global variable holds the date from when I am on vacation and yes I have another one for when the vacation ends.

    So anyone has any great oneline code for this, or do I need to go to a full script file for this?

    #2
    Try this:

    Code:
    &nhs.SetDeviceString(592, DateTime.parse(FormatDateTime(hs.GetVar("gv_tod_vacation_from"))).ToString("yyyy-MM-dd") ,False)
    Jon

    Comment


      #3
      Very nice - works perfectly!!

      Very very LARGE thanks!

      Comment

      Working...
      X