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
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-23-2021 , 17:22   Re: Precise calculation between 2 dates and times in UnixTimestamp
Reply With Quote #4

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;

__________________
Bugsy is offline
 



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