2

I'm getting different @sys-time outputs for the same intent #what-time when deployed on the server and when testing in the Watson conversation. Where am I going wrong here? The context variable is set to my Country timezone:Asia/calcutta. I have attached the image!

screen shot

Sayuri Mizuguchi
  • 5,250
  • 3
  • 26
  • 53
  • In your screenshot, i don't see any difference in outputs. During the testing in watson conversation, the block with the green border it is debugging block. In your screenshot output from website is: 2017-06-13 08:57:33 and output from testing tool is: 2017-06-13 14:29:02 – Victor Leontyev Jun 13 '17 at 10:32
  • They were taken at the exact same time. The difference between them is 6hrs+ – Sumanth Saligram Jun 13 '17 at 11:51

1 Answers1

4

I have the same problem a few weeks ago. And, you saw within the IBM Bluemix, Watson Conversation Service set the context variable timezone. That is, you should do the same with the code.

Within your application set the context variable timezone to your zone. Like:

data.context.timezone = "America/Sao_Paulo"

Obs.: Data are the return from Watson Conversation Service (Intents, entities, context variables, etc)

This example is with Nodejs, but you can try using any Programming language.

Check (timezone is set within the Conversation Service):

enter image description here

Check (timezone is set within my application with code):

enter image description here

EDIT(Where you add this code?):

//add inside your call, like:
conversation.message(payload, function (err, data) {
    data.context.timezone = "America/Sao_Paulo";
    if (err) {
      return res.status(err.code || 500).json(err);
    }
    updateMessage(payload, data, req, res);

  });
}); 
Sayuri Mizuguchi
  • 5,250
  • 3
  • 26
  • 53
  • Thanks for the answer. But Where am I supposed to add this line : "data.context.timezone=' ' " ?? – Sumanth Saligram Jun 13 '17 at 20:46
  • 1
    Inside the call for conversation service, if you're using nodejs, the [conversation simple](https://github.com/watson-developer-cloud/conversation-simple) have the `updateMessage` [function](https://github.com/watson-developer-cloud/conversation-simple/blob/master/app.js#L70), you can add inside this function, in this case, `response.context.timezone` :) – Sayuri Mizuguchi Jun 13 '17 at 20:48
  • I added it this way : function updateMessage(input, response) { response.context.timezone="Asia/Calcutta"; //rest of the code follows} But it doesnt seem to work – Sumanth Saligram Jun 14 '17 at 08:58
  • Check my edit, you can add inside call for the conversation, like my example – Sayuri Mizuguchi Jun 14 '17 at 12:42