Raised This Month: $ Target: $400
 0% 

convert DATE


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 05-04-2011 , 23:29   convert DATE
Reply With Quote #1

i would by convert this date:

PHP Code:
02.05.2011    >>>    2.5.2011 
(Remove 0, of the day and month)

PHP Code:
new DATE[13];
new 
DAY[03],MONTH[03],YEAR[5];

    
get_time("%d",DAY,charsmax(DAY));
    
get_time("%m",MONTH,charsmax(MONTH));
    
get_time("%Y",YEAR,charsmax(YEAR))

    
replace_all(DAY,1,"0","")
    
replace_all(MONTH,1,"0","")

    
formatex(DATE,charsmax(DATE),"%s.%s.%s",DAY,MONTH,YEAR)
    
    
client_print(id,3,"[LOL] DATE: %s",DATE
This is Correct? Any bug? suggestions ?

Thanks
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 05-04-2011 at 23:31. Reason: Added client_print(id,3,"[LOL] DATE: %s",DATE)
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-04-2011 , 23:54   Re: convert DATE
Reply With Quote #2

Off the top of my head:

PHP Code:
formatex(DATE,charsmax(DATE),"%d.%d.%s",str_to_num(DAY),str_to_num(MONTH),YEAR
__________________
fysiks is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 05-05-2011 , 00:00   Re: convert DATE
Reply With Quote #3

I will testing (Tks)
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-05-2011 , 00:00   Re: convert DATE
Reply With Quote #4

Oh, and if doing my way, you should remove the replace_all() functions (as my solution is an alternative to using replace_all).
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-05-2011 , 01:46   Re: convert DATE
Reply With Quote #5

PHP Code:
    new DATE[11]
    
get_time("%d.%m.%Y"DATEcharsmax(DATE))
    if( 
DATE[3] == '0' )
    {
        
replace(DATE[3],charsmax(DATE)-3"0""")
    }
    
client_print(idprint_chat"[LOL] DATE: %s"DATE[0] == '0' DATE[1] : DATE
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 04:28.


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