Raised This Month: $ Target: $400
 0% 

dele


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
0920357689
Senior Member
Join Date: Apr 2008
Old 03-24-2011 , 05:41   dele
Reply With Quote #1

dele

Last edited by 0920357689; 12-27-2011 at 10:14.
0920357689 is offline
katna
Senior Member
Join Date: May 2010
Old 03-24-2011 , 06:04   Re: how to get the date
Reply With Quote #2

You can take a look at exolent code of unbantime
PHP Code:
GenerateUnbanTime(const bantimeunban_time[], len)
{
    static 
_hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7];
    
format_time(_hourssizeof(_hours) - 1"%H");
    
format_time(_minutessizeof(_minutes) - 1"%M");
    
format_time(_secondssizeof(_seconds) - 1"%S");
    
format_time(_monthsizeof(_month) - 1"%m");
    
format_time(_daysizeof(_day) - 1"%d");
    
format_time(_yearsizeof(_year) - 1"%Y");
    
    new 
hours str_to_num(_hours);
    new 
minutes str_to_num(_minutes);
    new 
seconds str_to_num(_seconds);
    new 
month str_to_num(_month);
    new 
day str_to_num(_day);
    new 
year str_to_num(_year);
    
    
minutes += bantime;
    
    while( 
minutes >= 60 )
    {
        
minutes -= 60;
        
hours++;
    }
    
    while( 
hours >= 24 )
    {
        
hours -= 24;
        
day++;
    }
    
    new 
max_days GetDaysInMonth(monthyear);
    while( 
day max_days )
    {
        
day -= max_days;
        
month++;
    }
    
    while( 
month 12 )
    {
        
month -= 12;
        
year++;
    }
    
    
formatex(unban_timelen"%i:%02i:%02i %i/%i/%i"hoursminutessecondsmonthdayyear);
}

GetDaysInMonth(monthyear=0)
{
    switch( 
month )
    {
        case 
1:        return 31// january
        
case 2:        return ((year 4) == 0) ? 29 28// february
        
case 3:        return 31// march
        
case 4:        return 30// april
        
case 5:        return 31// may
        
case 6:        return 30// june
        
case 7:        return 31// july
        
case 8:        return 31// august
        
case 9:        return 30// september
        
case 10:    return 31// october
        
case 11:    return 30// november
        
case 12:    return 31// december
    
}
    
    return 
30;

katna is offline
0920357689
Senior Member
Join Date: Apr 2008
Old 03-24-2011 , 06:07   Re: how to get the date
Reply With Quote #3

how to call this function


link this?
new time[XX]
GenerateUnbanTime(100 minute, time[], XX-1)
0920357689 is offline
katna
Senior Member
Join Date: May 2010
Old 03-24-2011 , 06:10   Re: how to get the date
Reply With Quote #4

1. Change function name to match your task
2. Change the unban_time format
PHP Code:
  formatex(unban_timelen"%i:%02i:%02i %i/%i/%i"hoursminutessecondsmonthdayyear); 
3. Use
PHP Code:
new szDate[32]
GenerateTommorowDate(24*60szDatecharsmax(szDate)); 
katna is offline
0920357689
Senior Member
Join Date: Apr 2008
Old 03-24-2011 , 06:21   Re: how to get the date
Reply With Quote #5

thank you very much!
0920357689 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-24-2011 , 19:15   Re: how to get the date
Reply With Quote #6

Quote:
Originally Posted by katna View Post
You can take a look at exolent code of unbantime
PHP Code:
GenerateUnbanTime(const bantimeunban_time[], len)
{
    static 
_hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7];
    
format_time(_hourssizeof(_hours) - 1"%H");
    
format_time(_minutessizeof(_minutes) - 1"%M");
    
format_time(_secondssizeof(_seconds) - 1"%S");
    
format_time(_monthsizeof(_month) - 1"%m");
    
format_time(_daysizeof(_day) - 1"%d");
    
format_time(_yearsizeof(_year) - 1"%Y");
    
    new 
hours str_to_num(_hours);
    new 
minutes str_to_num(_minutes);
    new 
seconds str_to_num(_seconds);
    new 
month str_to_num(_month);
    new 
day str_to_num(_day);
    new 
year str_to_num(_year);
    
    
minutes += bantime;
    
    while( 
minutes >= 60 )
    {
        
minutes -= 60;
        
hours++;
    }
    
    while( 
hours >= 24 )
    {
        
hours -= 24;
        
day++;
    }
    
    new 
max_days GetDaysInMonth(monthyear);
    while( 
day max_days )
    {
        
day -= max_days;
        
month++;
    }
    
    while( 
month 12 )
    {
        
month -= 12;
        
year++;
    }
    
    
formatex(unban_timelen"%i:%02i:%02i %i/%i/%i"hoursminutessecondsmonthdayyear);
}

GetDaysInMonth(monthyear=0)
{
    switch( 
month )
    {
        case 
1:        return 31// january
        
case 2:        return ((year 4) == 0) ? 29 28// february
        
case 3:        return 31// march
        
case 4:        return 30// april
        
case 5:        return 31// may
        
case 6:        return 30// june
        
case 7:        return 31// july
        
case 8:        return 31// august
        
case 9:        return 30// september
        
case 10:    return 31// october
        
case 11:    return 30// november
        
case 12:    return 31// december
    
}
    
    return 
30;

Wow. That's a lot of code. Here is a much simpler form:

PHP Code:
GenerateUnbanTime(const bantime_minutesunban_time[], len)
{
    new 
timestamp get_systime()
    
timestamp += (bantime_minutes 60)
    
format_time(unban_timelen"%H:%M:%S %m/%d/%y"timestamp)

__________________
fysiks is offline
Reply



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 14:37.


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