[Gambas-user] gb3: Format$

Benoît Minisini gambas at ...1...
Sat Jun 25 00:42:41 CEST 2011


> I'm using this to print a formatted date:
> 
> Draw.Text("Date and Time: " & CDate(Server.DateCurrent) & " (" &
> Format$(CDate(Server.DateCurrent), "hh:nn:AM/PM") & ")", 32, ystart - 1)
> 
> It seems that Format$ actually changes the value of Server.DateCurrent,
> making it AM when it should be PM. Format$ is actually forcing the hour
> to be between 1 and 12. Shouldn't Format$ simply return a value and not
> overwrite the expression?

Format$() does not change its arguments, as any other functions in Gambas.

When AM/PM is specified, the hour is displayed between 1 and 12. If the real 
hour is greater or equal than 12:00, then PM is printed. Otherwise AM is 
printer.

Regards,

-- 
Benoît Minisini




More information about the User mailing list