0

I am trying to get the current hour of the day using date: "%H" in a set variables widget. I do the this first on day of month (date: "%d") which works okay, but the hour doesn't appear to return any value, any suggestions?

Basically, trying to compensate for the time difference in UK and US, using 'now'.

image loaded here.

philnash
  • 70,667
  • 10
  • 60
  • 88
Paul
  • 1
  • 2
  • Can you show a screenshot of your widget to show how you're using it? – philnash Sep 13 '22 at 00:30
  • Basically, I am in the UK and trying to compensate for the US 'PDT' time in the 'now' function for the current date. – Paul Sep 13 '22 at 07:08

1 Answers1

0

From your screenshot I can see one use of %H in which you set a time_zone variable to {{ 'now' | date: " %H %M " }}. I can then see you are comparing that time_zone variable as a time.

When you compare as a time in Studio you need to provide the time in the form "HH:MM", but it seems you have it in the format " HH MM ".

Try setting the variable to be {{ 'now' | date: "%H:%M" }} and see if things work.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Thanks for this but it seems to be allocating it as a string of characters to the variable from the pipe character to the closing quote. – Paul Sep 13 '22 at 13:15
  • I am going on vacation this evening, so I have sorted the problem by saying today's message is available after 8am each morning. Many thanks for your considerations. – Paul Sep 13 '22 at 14:43
  • Glad it's sorted in the meantime. I was able to set the various date formats correctly in my own Studio Flow, so I don't know what's going on with yours. You might find it easier to open a ticket with [Twilio support](https://www.twilio.com/help/contact) who could take a look at your Flow and help out. – philnash Sep 14 '22 at 02:09
  • When I get back when I will have time to investigate further. I checked today and the work-a-round is functioning fine. – Paul Sep 14 '22 at 08:09
  • Good stuff, would love to help more if I can when you’re back. – philnash Sep 14 '22 at 09:51
  • I got a very complex answer to the ticket, basically telling it is a time zone problem with now, and have given a number of solutions I need to unpack, one using a function. But I'm away now so I'll get back to it. – Paul Sep 14 '22 at 16:05