Asked  7 Months ago    Answers:  5   Viewed   21 times

If I do

alert(new Date(1313690400000))

returns: Thu Aug 18 2011 13:00:00 GMT-0500 (CDT)

however, PHP

echo date('Y-m-d H:i:s', 1313690400000);

returns: 1951-12-14 05:50:24

 Answers

24

JavaScript uses milliseconds as a timestamp, whereas PHP uses seconds. As a result, you get very different dates, as it is off by a factor 1000.

So remove three zeroes at the PHP side:

echo date('Y-m-d H:i:s', 1313690400);
Wednesday, March 31, 2021
 
MoarCodePlz
answered 7 Months ago
14

Looking at your question it seems you have the logic the wrong way around. The current time is always bigger then a time in the past. Try the following:

if($time_now>$auction->time_end){
//...
}
Wednesday, March 31, 2021
 
toesslab
answered 7 Months ago
67

If you don't care about perfect accuracy:

return $interval->days / 365;

You could also do something like return $interval->y + $interval->m / 12 + $interval->d / 365.

Didn't even notice your weird decimal convention until I saw @2unco's comment. That would look like: return $interval->y . '.' . $interval->m.

Friday, May 28, 2021
 
TecHunter
answered 5 Months ago
21

Seems to be a bug. If the string sent to Date() is formatted as 2012/03/21 instead of 2012-03-21. The date seems right.

Tuesday, June 22, 2021
 
Gilko
answered 4 Months ago
68

Is there something in the Android developer guidelines that disuadea developers from providing the option to "exit" (stop running) an application from within the application itself?

Yes. It is generally not needed, just as it is generally not needed to restart a Web server because some user with a browser decided (s)he is done with a Web app.

the vast majority of apps don't have their own Exit functions and hence just keep running forever

They don't keep running forever. Android will close things up as needed.

don't give you a choice about running when you turn on the phone - they just do by default

Those developers aren't paying attention to me.

Both of these things lead to memory usage constantly increasing

Generally, it doesn't. If you find specific apps that do this, uninstall them.

and your device running with this performance burden all of the time

Generally, it doesn't. If you find specific apps that do this, uninstall them.

Also, this question is a duplicate of this one.

Wednesday, August 4, 2021
 
muncherelli
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :