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

Changing the generated time

hi how can i change the time that is auto generated? Image

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Changing the generated time

Hi Lim,

This is the generated time stamp from DB service, which way you want to change it?

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

Changing the generated time

Maybe it can be in 12 hours without generating the seconds? like those weird decimals behind it.

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

Changing the generated time

Hello Lim,

Appery.io DB always saves date time, you may not display the time, for example like this:
You can add this JS on the mapping of the label that displays the date:

codevar d = new Date(value),
minutes = d.getMinutes().toString().length == 1 ? '0'+d.getMinutes() : d.getMinutes(),
hours = d.getHours().toString().length == 1 ? '0'+d.getHours() : d.getHours(),
ampm = d.getHours() >= 12 ? 'pm' : 'am',
months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
return days[d.getDay()]+' '+months[d.getMonth()]+' '+d.getDate()+' '+d.getFullYear()+' '+hours+':'+minutes+ampm;/code

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

Changing the generated time

Hi, have tried your codes. But still doesn't work.
Mapping of the label as in just click on events and add in the code when i run JS right?
Image

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

Changing the generated time

Hi Lim,

You need add this code to "Add JS" in your mapping where you link the date field to label.

See details: http://prntscr.com/40i215/direct

Also don't forget to delete this code from current place.

Regards.

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

Changing the generated time

Hi,
followed the steps, when i add in the code, the date works. However, the problem now is I am unable to send out messages

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Changing the generated time

Hi Lim,

Do you mean PushNotifications? Could you please clarify what you tried and what doesn't work?

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

Changing the generated time

i Added in the codes in the JS, the time is able to display but I couldn't send out messages.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Changing the generated time

Hi Lim,

If you want to add current date use:prevar d = new Date()/preInstead of:prevar d = new Date(value)/pre

Return to “Issues”