Únete a Bot Libre de Socios y Afiliados programa y el apoyo de nuestra libre plataforma abierta
Self, AIML, and scripting

date and time script

por dpiaggesi publicado 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: 2149, today: 0, week: 2, month: 4

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: 2170, today: 0, week: 3, month: 8

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: 2616, today: 0, week: 2, month: 9

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: 2051, today: 0, week: 1, month: 6

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: 2320, today: 1, week: 3, month: 8

Id: 13959837
Publicado: Sep 9 2016, 7:05
Respuestas: 5
Vistas: 2766, hoy: 1, la semana: 2, mes: 7
0 0 0.0/5