Jump to content
Sign in to follow this  
rajeshontheweb

Pure laziness, pls help string formatting.

Recommended Posts

rajeshontheweb

i have a text in this format

Input 15 Feb 2009 16:47 :0500
Output dd = 15, mmm = feb , yyyy = 2009 , hh = 16; mm = 47; ssss = 0500

i need it to be formatted as date or even if i get it as an array of texts i am ok

thanks a lot in advance. because i am working my mind on something else and i think there will be enough minds here to do it in seconds.

:-)

Edited by rajeshontheweb

Share this post


Link to post
Share on other sites
rajeshontheweb

got it already :-)

Func _Str2Date($InputString)

Local $OutPutDate[6]

$InputString = "15 Feb 2009 16:47 :0500"

While 1 ; trim spaces if there are any , at the start.
    If StringMid($InputString,1,1)= " " Then 
        StringTrimLeft($InputString,1)
    Else
        ExitLoop
    EndIf
WEnd

$OutPutDate[0] = Number(StringMid($InputString,1,2))
$OutPutDate[1] = StringMid($InputString,4,3)
$OutPutDate[2] = Number(StringMid($InputString,8,4))
$OutPutDate[3] = Number(StringMid($InputString,13,2))
$OutPutDate[4] = Number(StringMid($InputString,16,2))
$OutPutDate[5] = Number(StringMid($InputString,20,4))
 
 
    Return $OutPutDate
 EndFunc
Edited by rajeshontheweb

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×