[Ajuda] Include convert days
#1

Alguйm me manda um link da convert days do tуpico do dan tб quebrado o link
Reply
#2

Usa essa stock. Nгo sei quem fez. Nгo lembro mas ela й boa nгo tem qualquer bug

PHP код:
stock convertTimestamptimestamp_form=)
{
    
timestamp -= 10800;
    new 
year=1970day=0month=0hour=0mins=0sec=0;

    new 
days_of_month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
    new 
names_of_month[12][10] = {"Janeiro","Fevereiro","Marзo","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"};
    new 
returnstring[32];

    while(
timestamp>31622400){
        
timestamp -= 31536000;
        if ( ((
year == 0) && (year 100 != 0)) || (year 400 == 0) ) timestamp -= 86400;
        
year++;
    }

    if ( ((
year == 0) && (year 100 != 0)) || (year 400 == 0) )
        
days_of_month[1] = 29;
    else
        
days_of_month[1] = 28;


    while(
timestamp>86400){
        
timestamp -= 86400day++;
        if(
day==days_of_month[month]) day=0month++;
    }

    while(
timestamp>60){
        
timestamp -= 60mins++;
        if( 
mins == 60mins=0hour++;
    }

    
sec=timestamp;

    switch( 
_form ){
        case 
1format(returnstring31"%02d/%02d/%d %02d:%02d:%02d"day+1month+1yearhourminssec);
        case 
2format(returnstring31"%s %02d, %d, %02d:%02d:%02d"names_of_month[month],day+1,yearhourminssec);
        case 
3format(returnstring31"%d %c%c%c %d, %02d:%02d"day+1,names_of_month[month][0],names_of_month[month][1],names_of_month[month][2], year,hour,mins);
        case 
4format(returnstring31"%02d.%02d.%d-%02d:%02d:%02d"day+1month+1yearhourminssec);
        case 
5format(returnstring31"%02d/%02d/%d"day+1month+1year);
        case 
6format(returnstring31"%02d:%02d:%02d"hourminssec);
        default: 
format(returnstring31"%02d:%02d:%02d %02d/%02d/%d"hourminssecday+1month+1year);
    }

    return 
returnstring;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)