Dołącz do BOT Libre projekt open source na BotLibre.org
Self, AIML, and scripting

date and time script

w dpiaggesi wysłany 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: 2140, today: 1, week: 3, month: 34

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: 2156, today: 1, week: 6, month: 47

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: 2601, today: 3, week: 6, month: 40

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: 2038, today: 1, week: 3, month: 31

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: 2303, today: 2, week: 3, month: 32

Identyfikator: 13959837
Wysłany: Sep 9 2016, 7:05
Odpowiedzi: 5
Widok: 2755, dziś: 2, tydzień: 9, miesiąc: 42
0 0 0.0/5