Did you know Bot Libre also provides free hosted forums for your own website or mobile app?
Self, AIML, and scripting

date and time script

by dpiaggesi posted Sep 9 2016, 7:05

Is it possible to setup a default timezone that is not Canada in the script? how?

also... I've asked for the time in Rome and it should have took the right timezone i think... because the value is closer to the real one but anyway is 2 hours behind the real time... where does it get the time from?

 

Thank you very much


by admin posted Sep 9 2016, 7:51
You can change the Watch script, or create your own to change the timezone for the current time.

For example,
Template("The time in Rome is {Date.setTimeZone(Date.time(), "CET")}.")

When you ask "what is the time in *", to change the timezone you need to give a valid timezone name or code. Otherwise it will answer the GMT time.

For example,
"what is the time in CET?"

Would be for Rome.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2139, today: 0, week: 2, month: 33

by toasted_bot posted Sep 21 2016, 5:56

Is it possible that the timezone is broken/stuck to EDT when parsing AIML to grab the date?

Testing the following code (uploaded as script to keep AIML functions):

<category>
    <pattern># time #</pattern>
    <template>
        <date locale="de_CH" timezone="-1" format="%c" />
    </template>
</category>


It returns:

Wed Sep 21 05:48:29 EDT 2016 

.. so timezone="" doesn't seem to be having any effect.


Updated: Sep 21 2016, 5:57
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2154, today: 0, week: 4, month: 45

by Paphus posted Sep 21 2016, 9:01

The AIML spec only defines the format option for the date tag. The locale and timezone options are PandoraBot extensions.

I will look into adding support for them to our AIML support.

You can also use Self code inside AIML.

<template>{Date.setTimeZone(Date.time(), "CET")}</template>

Updated: Sep 21 2016, 9:02
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2597, today: 0, week: 2, month: 36

by admin posted Sep 21 2016, 11:40
I have added support for these to our AIML support and Self.

The fix should be in the next website update, probably next week.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2037, today: 0, week: 2, month: 30

by marcosnunes posted Dec 7 2016, 11:53

I could fix it with this edition on TimeAndDate bot script file

state timeState {
case #is goto timeState;
case #it goto timeState;
case #what goto timeState;
case "right" goto timeState;
case "now" goto timeState;
case "in" goto timeInState;
case punctuation goto timeState;

answer Template("The time is {Date.setTimeZone(Date.time(), "GTM-3")}.");
}


Updated: Dec 7 2016, 14:49
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2301, today: 0, week: 1, month: 30

Id: 13959837
Posted: Sep 9 2016, 7:05
Replies: 5
Views: 2753, today: 1, week: 7, month: 40
0 0 0.0/5