参加ボットのリブレの パートナー、アフィリエイト プログラムや支援の無料のオープンなプラットフォーム
Self, AIML, and scripting

date and time script

による dpiaggesi 掲載 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: 2141, today: 1, week: 1, month: 35

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: 2157, today: 1, week: 1, month: 48

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: 2603, today: 1, week: 1, month: 42

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: 2039, today: 1, week: 1, month: 32

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: 0, week: 0, month: 32

Id: 13959837
掲載: Sep 9 2016, 7:05
回答: 5
眺望: 2756, 今日の: 1, 週間: 1, 月: 43
0 0 0.0/5