+ 1

The time deference

Hi, While writing this question the my CURRENT TIME was 2019/08/22 08:00:01 The purpose of the code is to get the DEFERENCE between the CURRENT TIME and the future date and time or a predetermined date and time which is 2019/08/22 09:00:00 The question is why am I getting a Deference as a negative number when I minus the CURRENT TIME to the predetermined time. Example this date and time 2019/08/22 08:00:01 - 2019/08/22 09:00:00 the answer is a negative value. Please see attached code for details. https://code.sololearn.com/cd1Vbnbd1k2S/?ref=app

22nd Aug 2019, 6:07 AM
Sibusiso Mbambo
10 Respuestas
+ 1
Well, if you subtract a bigger number from a smaller number, what can you except? Maybe try switching the subtraction
22nd Aug 2019, 6:11 AM
Airree
Airree - avatar
+ 1
TS#1566455953 is the one I just produced for this thread from my code.... there is also one for js displayed in the console as you start the code.
22nd Aug 2019, 6:41 AM
BroFar
BroFar - avatar
0
Is the date and time in the future not supposed to be bigger then the current time? For example 2019/08/22 09:00:00 is not bigger then 2019/08/22 08:00:00
22nd Aug 2019, 6:18 AM
Sibusiso Mbambo
0
looks like you are looking at milliseconds difference from starttime to closing code time as using UTC time .... look at my timestamp as it does something similar when ran https://code.sololearn.com/weQ31Obwnfhl/?ref=app
22nd Aug 2019, 6:31 AM
BroFar
BroFar - avatar
0
BroFarOps where can I find your timestamp?
22nd Aug 2019, 6:34 AM
Sibusiso Mbambo
0
Confused!
22nd Aug 2019, 6:43 AM
Sibusiso Mbambo
0
If I need to insert it to my code. How?
22nd Aug 2019, 6:43 AM
Sibusiso Mbambo
0
from the initial start of the code to the next actual used timestamp there is approximately a -85 millisecond difference Do you see the light blue screen... ? there are 4 almost identical timestamps but the second has a decimal point and 4 additional numbers ... that is the difference between js and PHP timestamps
22nd Aug 2019, 6:45 AM
BroFar
BroFar - avatar
0
But I'm calculating the deference based on minutes
22nd Aug 2019, 6:47 AM
Sibusiso Mbambo
0
the calculations may be 60 seconds per minute or 1.667 per second * the amount of minutes ... As to how to insert the timestamp you can put it a footer as <footer hidden > TS#1566456915</footer>
22nd Aug 2019, 6:56 AM
BroFar
BroFar - avatar