Raised This Month: $ Target: $400
 0% 

Solved Precise calculation between 2 dates and times in UnixTimestamp


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 06-23-2021 , 17:45   Re: Precise calculation between 2 dates and times in UnixTimestamp
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Does this help?
PHP Code:
#include <amxmodx>

public plugin_init() 
{
    new const 
FutureDate[] = "14:00:00 06/25/2021";
    
    new 
iFutureDateTime parse_timeFutureDate "%H:%M:%S %m/%d/%Y" );
    new 
iCurrentDateTime get_systime();
    new 
iTimeDifference iFutureDateTime iCurrentDateTime;
    new 
iDays iHours iMinutesiSeconds;
    
    
convert_secondsiTimeDifference iSeconds iMinutes iHours iDays );
    
    
server_print"%s is %d days, %d hours, %d minutes, %d seconds away" FutureDate iDays iHours iMinutes iSeconds );
}

convert_secondsiTotalSeconds , &seconds , &minutes , &hours , &days 
{
    
days iTotalSeconds 86400;
    
hours = ( iTotalSeconds 3600 ) % 24;
    
minutes = ( iTotalSeconds 60 ) % 60;
    
seconds iTotalSeconds 60;

In a way yes, I think I'll have to create an array with all the "Saturdays" of the year to be able to save the parse_time automatically since the event will always recur on the same day and time.

Edit: And that made me have an idea of ​​what to do, I will use part of my stock with part of yours, so I take how many days are left until the required date, and I use parse_time, thanks.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 06-23-2021 at 17:47.
iceeedr is offline
Send a message via Skype™ to iceeedr
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode