Page 1 of 1

Unable to Appery style datetime stamp last logged in

Posted: Thu Feb 27, 2014 9:14 pm
by Bad Addy

Is there is a way to get a timedate stamp thats identical to how a createdAt format in javascript in Appery. I need to stamp the last time they logged in, and compare it with the time NOW. But, in the same format, as a string, like Appery does in the database ?

I have searched the docs, but i cant see how ?


Unable to Appery style datetime stamp last logged in

Posted: Thu Feb 27, 2014 9:27 pm
by Bad Addy

As an example, the below image, how did you populate the colume Time, did you use a code from the Appery Library ?

Image


Unable to Appery style datetime stamp last logged in

Posted: Thu Feb 27, 2014 9:47 pm
by Illya Stepanov

Unable to Appery style datetime stamp last logged in

Posted: Thu Feb 27, 2014 9:55 pm
by Bad Addy

Not sure that link really answered my question at all!

I will assume you have no function within the Appery library for it, so I created my own:

precode
function setdateFormat() {
var d = new Date();
var date = d.getDate();
var month = d.getMonth() + 1;
var year = d.getFullYear();
var hours = d.getHours();
var mins = d.getMinutes();

Code: Select all

 if (month < 10) { 
     month = '0' + month; 
 } 

 var datestring = year + "-" + month + "-" + date + " " + hours + ":" + mins + ":00&#46;000&quot 
 console&#46;log(datestring); 
 return datestring; 

}

/code/pre

This returns the correct format!.


Unable to Appery style datetime stamp last logged in

Posted: Thu Feb 27, 2014 10:18 pm
by Illya Stepanov

Thanks for sharing this, Bad Addy!