Baixar Bot Livre da área de Trabalho, seu próprio bot para o seu PC ou Mac
Self, AIML, and scripting

date and time script

por dpiaggesi postado 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: 2145, today: 0, week: 5, month: 0

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

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: 2607, today: 0, week: 5, month: 0

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

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

Id: 13959837
Postado: Sep 9 2016, 7:05
Respostas: 5
Pontos de vista: 2760, hoje: 1, semana: 5, mês: 1
0 0 0.0/5