Raised This Month: $2 Target: $400
 0% 

UnixTime Problem with admin mysql


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
spamipolito
Junior Member
Join Date: Jun 2018
Old 06-27-2020 , 01:52   UnixTime Problem with admin mysql
Reply With Quote #1

Hi Guys. I have a problem with a new admin system.

I have these data:


admin_vencimiento = expiration date
admin_horavencimiento = expiration hour

Load data and convert with unixtime

PHP Code:
            new szDate[12], szDay[3], szMonth[3], szYear[5]

            
mysql_read_resultmysql_fieldnametonum"admin_vencimiento" ), szDate11 )
            
replace_all(szDatecharsmax(szDate), "/"" ")
            
parse(szDateszDay2szMonth2szYear4);


            new 
szHours[9], szHour[3], szMinute[3], szSecond[3]

            
mysql_read_resultmysql_fieldnametonum"admin_horavencimiento" ), szHours)
            
replace_all(szHourscharsmax(szHours), ":"" ")
            
parse(szHoursszHour2szMinute2szSecond2);

            
server_print("Admin Expiration Date Convert: %d"TimeToUnix(str_to_num(szYear), str_to_num(szMonth), str_to_num(szDay), str_to_num(szHour), str_to_num(szMinute), 0UT_TIMEZONE_SERVER)) 
Printing timestamp with console server:

Admin Expiration Date Convert: 1595691840

Convert timestamp (1595691840) with page:


This is real expiration hour:


Sorry for my bad english, i am from argentina

Last edited by spamipolito; 06-27-2020 at 01:54.
spamipolito is offline
krisztian2
Junior Member
Join Date: Feb 2019
Old 06-30-2020 , 11:47   Re: UnixTime Problem with admin mysql
Reply With Quote #2

You have to divide this unix value with 86400. That, you get day format.
krisztian2 is offline
spamipolito
Junior Member
Join Date: Jun 2018
Old 07-01-2020 , 14:56   Re: UnixTime Problem with admin mysql
Reply With Quote #3

Quote:
Originally Posted by krisztian2 View Post
You have to divide this unix value with 86400. That, you get day format.
That makes no sense. TimeToUnix convert date day/hour to timestamp.

PHP Code:
stock TimeToUnix( const iYear , const iMonth , const iDay , const iHour , const iMinute , const iSecond TimeZones:tzTimeZone=UT_TIMEZONE_UTC)
{
    new 
iTimeStamp;

    for ( 
1970 iYear i++ )
        
iTimeStamp += YearSecondsIsLeapYear(i) ];

    for ( 
iMonth i++ )
        
iTimeStamp += SecondsInMonthiYear );

    
iTimeStamp += ( ( iDay ) * DaySeconds );
    
iTimeStamp += ( iHour HourSeconds );
    
iTimeStamp += ( iMinute MinuteSeconds );
    
iTimeStamp += iSecond;

    if ( 
tzTimeZone == UT_TIMEZONE_SERVER )
        
tzTimeZone GetTimeZone();
        
    return ( 
iTimeStamp TimeZoneOffsettzTimeZone ] );

Solved:

PHP Code:

UT_TIMEZONE_SERVER
// --->
UT_TIMEZONE_ART 
spamipolito is offline
Reply


Thread Tools
Display Modes

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 15:52.


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