[Gambas-user] gb3: Format$

EA7DFH ea7dfh at ...2382...
Sun Jun 26 12:40:56 CEST 2011


El 26/06/11 05:54, Kevin Fishburne escribió:
> On 06/25/2011 09:41 PM, nando wrote:
>> Yes-Silly me!
>> How about trying the print statements with ; and not&
>> I'm curious how the bug manifests.
> 
> It displays the same results:
> 
> Public Sub Main()
> 
>    Dim t As Float
> 
>    t = CFloat(Now) ' Current time and date.
> 
>    Print "1: CDate(t):                         "; CDate(t)
>    Print "2: Format$(CDate(t), \"hh:nn:AM/PM\"): "; Format$(CDate(t), 
> "hh:nn:AM/PM")
>    Print "3: CDate(t):                         "; CDate(t)
>    Print "4: Format$(CDate(t), \"hh:nn:AM/PM\"): "; Format$(CDate(t), 
> "hh:nn:AM/PM")
>    Print "5: CDate(t):                         "; CDate(t)
> 
> End
> 
> 1: CDate(t):                         06/25/2011 23:52:54
> 2: Format$(CDate(t), "hh:nn:AM/PM"): 11:52:PM
> 3: CDate(t):                         06/25/2011 11:52:54
> 4: Format$(CDate(t), "hh:nn:AM/PM"): 11:52:AM
> 5: CDate(t):                         06/25/2011 11:52:54


Hi all

>> 
>> Out of curiousity, what's the difference between concatenating strings 
>> with ";" versus "&"?
>> 

@Kevin

Well, AFAIK using ';' (semicolon) inserts a single '\t' (tab character)
and ';;' (double semicolon) inserts a single space. Someone could
correct me if I'm wrong.

Returning to the main question, I've tested your example with a slight
modification and things went worse... It doesn't print 'AM/PM' at all:

 Print "1: CDate(t):                          "; CDate(t)
 Print "2: Format$(CDate(t), \"hh:nn AM/PM\"):"; Format$(CDate(t),
"hh:nn AM/PM")
 Print "3: CDate(t):                          "; CDate(t)
 Print "4: Format$(CDate(t), \"hh:nn:AM/PM\"):"; Format$(CDate(t),
"hh:nn:AM/PM")
 Print "5: CDate(t):                          "; CDate(t)

Notice the space instead of ':' (colon) in the 2nd line. These are the
results:

1: CDate(t):                          26/06/2011 12:40:29
2: Format$(CDate(t), "hh:nn AM/PM"):  12:40
3: CDate(t):                          26/06/2011 12:40:29
4: Format$(CDate(t), "hh:nn:AM/PM"):  12:40:
5: CDate(t):                          26/06/2011 12:40:29


System here is Linux Mint 10 (32bit), Gnome, Gambas3 rev. #3899 with
Spanish localization, if it matters somehow.

Best regards,

-- 
Jesus Guardon




More information about the User mailing list