Author Topic: Date OR Time, repeating Dates  (Read 9057 times)

IceBadger

  • Posts: 3
Date OR Time, repeating Dates
« on: June 01, 2016, 04:14:53 PM »
Hey!

It would be nice when setting a Date/Time value, and in Date/Time conditionals, to only use a Date or only use a Time, and be able to choose one or more days of the week, seperate or together.

This would allow setting a variable to the current time, and use an if conditional to see if the time is more or less than 11:00, that way a TTS response could be tailored depending on if it's Morning, Noon, Afternoon, Day, Evening, Night
Being able to check which day of the week it is would also be nice, checking if its a weekend or not for example.

An example TTS response could be:
"Have a good Saturday evening!"

Makes it a bit more human in responses than saying the current time.
With repeatable dates one could set up certain holidays, birthday(s) or other events the same way.

At the moment it seems like Date and Time is tied, so anything would only work that one time, that one day.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Date OR Time, repeating Dates
« Reply #1 on: June 01, 2016, 05:15:27 PM »
If you're looking for a "workaround", there are a number of tokens, found under "Text (and Text-To-Speech) Tokens" in the documentation, to format time:

to see if the time is more or less than 11:00, that way a TTS response could be tailored depending on if it's Morning, Noon, Afternoon, Day, Evening, Night
Code: [Select]
Begin Text Compare : [{EXP:{TIMEHOUR24} < 11 AND {TIMEHOUR24} > 4}] Equals '1'
    Say, 'Good morning.'
Else If Text Compare : [{EXP:{TIMEHOUR24} < 16 AND {TIMEHOUR24} > 11}] Equals '1'
    Say, 'Jubilant Noon.'
Else If Text Compare : [{EXP:{TIMEHOUR24} < 23 AND {TIMEHOUR24} > 16}] Equals '1'
    Say, 'Ecstatic Evening.'
Else
    Say, 'You should be sleeping right now, but who am I to judge.'
End Condition

Being able to check which day of the week it is would also be nice, checking if its a weekend or not for example.
Code: [Select]
Begin Text Compare : [{EXP:'{DATEDAYOFWEEK}' = 'Saturday' OR '{DATEDAYOFWEEK}' = 'Sunday'}] Equals '1'
    Say, 'It's Weekend, hurray!'
Else
    Say, 'It's a weekday. Oh joy.'
End Condition

With repeatable dates one could set up certain holidays, birthday(s) or other events the same way.
Code: [Select]
Begin Text Compare : [{DATE}] Equals 'june 2, 2016'
    Say, 'I'm sure it's someone's birthday today, so happy birthday to them.'
End Condition


Note that {DATEDAYOFWEEK} and {DATE} change with your regional settings, so I'd recommend using
Code: [Select]
Write '[Blue] {DATE} - {DATEDAYOFWEEK}' to log
To check your local formatting.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Date OR Time, repeating Dates
« Reply #2 on: June 01, 2016, 05:56:05 PM »
Pfeil: Master of EXP!!!


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Date OR Time, repeating Dates
« Reply #3 on: June 01, 2016, 06:31:06 PM »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Date OR Time, repeating Dates
« Reply #4 on: June 01, 2016, 06:49:17 PM »
LOL

Slan

  • Global Moderator
  • Newbie
  • *****
  • Posts: 30
Re: Date OR Time, repeating Dates
« Reply #5 on: June 04, 2016, 05:20:14 AM »
If you're looking for a "workaround", there are a number of tokens, found under "Text (and Text-To-Speech) Tokens" in the documentation, to format time:

.......


This is so succint, I have grabbed it and stuffed it into a profile for when I know I will need it later and can't find it. Kudos Pfeil!

IceBadger

  • Posts: 3
Re: Date OR Time, repeating Dates
« Reply #6 on: June 04, 2016, 03:16:17 PM »
Just had some time to test it out (was setting up a new PC) and it works!

Thank you soooo much Pfeil!


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Date OR Time, repeating Dates
« Reply #7 on: June 04, 2016, 05:29:06 PM »