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 , 18:30   Re: Precise calculation between 2 dates and times in UnixTimestamp
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
I guess I do not fully understand what you are trying to do. Can you explain a real world example?
Of course, I've just finished my idea, it needs some refinement, but it's already serving the purpose.

PHP Code:
public CalculateStrings()
{
        new 
Time[15], ToDay[5],  Month[5]

        
get_time("%A"Timecharsmax(Time))
        new 
EventDay CalculateDays(Time)

        
get_time("%d"ToDaycharsmax(ToDay))
        new 
iFutureDate str_to_num(ToDay) + EventDay

        get_time
("%m"Monthcharsmax(Month))

        new 
FormatedFutureDate[30]
        
formatex(FormatedFutureDatecharsmax(FormatedFutureDate), "19:00:00 %i/%i/2021"str_to_num(Month), iFutureDate)

        new 
iFutureDateTime parse_timeFormatedFutureDate "%H:%M:%S %m/%d/%Y" );
        new 
iCurrentDateTime get_systime();
        
Counter iFutureDateTime iCurrentDateTime;

        
set_task_ex(1.0"TimeToEvent"TASK_HUD_DROP, .flags SetTask_Repeat)
}

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

CalculateDays(const szDay[])
{
        new 
Count 0
        enum _
:ItemData
        
{
                
szDays[10],
                
iCount
        
}
        new const 
g_szDays[][ItemData] =
        {
                {
"Sunday",       1},
                {
"Monday",       2},
                {
"Tuesday",      3},
                {
"Wednesday",    4},
                {
"Thursday",     5},
                {
"Friday",       6},
                {
"Saturday",     7}
        }

        for(new 
isizeof g_szDaysi++)
        {
                if(
equali(szDayg_szDays[i][szDays]))
                {
                        
Count g_szDays[i][iCount]
                        break
                }
        }

        return 
Count

__________________


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/
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