Time difference
Hey. I want to know, if I have a time like:
2010-05-27 16:11:35 How can I check, if three minutes passed from that time? Like time is 2010-05-27 16:11:35 new newtime[x] get_time(newtime, xxx) if((newtime - time) > 3) passed but I need an exact example, cause I do not know. Thanks in advance. |
Re: Time difference
Are you able to use any other method for your storing your times? It can be done using a string time format like that but it will take more work. It would be easier if you stored the times in unix-time format (timestamp). You can easily determine exact difference (down to seconds) in 2 times with this.
http://forums.alliedmods.net/showthread.php?t=91915 |
Re: Time difference
Yeah, I can do it with timestamp, just couldn't find that.
Can you show me an example of how to get the difference? |
Re: Time difference
Quote:
Use get_systime() in your plugin to get the current unix time. Current time = 1276338840 5 hours from now = 1276356840 1276356840 - 1276338840 = 18000 MinuteSeconds = 60 HourSeconds = 3600 DaySeconds = 86400 18000 / 3600 = 5 |
| All times are GMT -4. The time now is 14:48. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.