Returning a value from a Function

Blitz3D Forums/Blitz3D Beginners Area/Returning a value from a Function

Zace(Posted 2003) [#1]
Hmmm - slight problem here. I run this function and the result i get is the hour - 1 chacrater :(

datetime$=Show_Time()

Function Show_Time()
date$ = Left(CurrentTime$(),5)+"/"+CurrentDate$()
Return date
End Function

Can someone show me what i'm doing wrong.

Many thanks.


WolRon(Posted 2003) [#2]
Hmm, your Show_Time function doesn't have a $.

Show_Time() or Show_Time%() returns an integer
Show_Time#() returns a float
Show_Time$() returns a string

So, returning date$ is only returning the first integer part of your string (in other words, the hour).


MSW(Posted 2003) [#3]
Erm...
datetime$ = Show_Time$()

Function Show_Time$()

;Might be that you need to let Blitz know the return type
;(#,%,$) when declareing a function...else it just dumps an
;integer in there

 
date$ = Left(CurrentTime$(),5)+"/"+CurrentDate$() 
Return date 
End Function




MSW(Posted 2003) [#4]
Opps...to slow :P