Date And time
Hello,
10006060*2 it's more than two hours
2 hours = 10006060*2=7200000 milliseconds. You could use google calculator to convert hours to milliseconds.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hello,
10006060*2 it's more than two hours
2 hours = 10006060*2=7200000 milliseconds. You could use google calculator to convert hours to milliseconds.
hey Igor,
else if((value.getTime() - now.getTime()) < (7200000)) {
alert("within 2 hours ");
this code doesnt work when implemented... pls do tell me an alternative! it still accepts the value within the timespan of 2 hours
Hi Ananya,
Here is the code that takes into account the time zone offset:prevar now = new Date();
var input = new Date(Appery("mobiletextinput_24").val());
var value = new Date(input.getTime() + now.getTimezoneOffset() * 60000);
var difference = value.getTime() - now.getTime();
if (difference < 7200000) {
alert("time span selected within 2 hours");
};/prePlease note: if you need a few checks of the time difference, it is better to perform a subtraction operation once, as shown in the example, and then - just use the variable that stores a result.
works perfectly THANK U!
Hello,
Is there any function which can give a difference of the number of days or number of weeks aslo ??
I am using this in the appery.oi server code to calculate the date +280 days from a particular date
var now = new Date();
var value = new Date(input.getTime() + 241920000);
// format as JSON and return the response
response.success(JSON.stringify({
greeting: value
}), "application/json");
Hello - Replied here - https://getsatisfaction.com/apperyio/...