Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Changing the generated time

Dear Lim,

Please specify in what problem you have.

Currently it's difficult to understand and help.

Regards.

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Changing the generated time

As i have stated earlier...

I added the code given above, but aint able to send out messages.
When i remove the code, i am able to send out messages, but the time and date does not.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Changing the generated time

As i told above i can send message.

Thus please add code you need and describe steps to reproduce the problem with message sending processing.

Regards.

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Changing the generated time

Hi, i have added to code. And thus, date is working but sending messages failed.

http://appery.io/app/mobile-frame?src...

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Changing the generated time

Hi Lim,

Please use following js code for "Date" field in "create message" request mapping:

pre

return new Date().toISOString().replace(/T.*/gi, "");

/pre

Regards.

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Changing the generated time

Hi thanks it works fine now! :)
Can i know how to change the time zone? As currently the time is according to your timezone.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Changing the generated time

Hello Lim,

Please look at this link: https://developer.mozilla.org/en-US/d...

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Changing the generated time

Hi,
Am i suppose to add this code :

var x = new Date();
var currentTimeZoneOffsetInHours = x.getTimezoneOffset() / 60;

under my response tab at the date in the javascript?
The link is not very clear.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Changing the generated time

Hi Lim,

Unfortunatly you can not change timeZone on Appery.io server.

But you can change time which is you show your users.

In this case you need to use following code:

pre

//Current time - please change this with date you need.
var pubDate = new Date();

//This is your goal time zone.
var offset = +5;

//Convert date to UTC
var utc = pubDate.getTime() + (pubDate.getTimezoneOffset() * 60000);

// create new Date object for different city
// using supplied offset
newDate = new Date(utc + (3600000*offset));

/pre

Regards.

Lim Samantha
Posts: 0
Joined: Wed Jun 11, 2014 6:50 am

Changing the generated time

Hi thanks but where do i place this code at?

Return to “Issues”