[Gambas-user] stop
francescokm at ...626...
francescokm at ...626...
Sun Jun 26 01:04:48 CEST 2011
Stop
Powered by Telkomsel BlackBerry®
-----Original Message-----
From: Kevin Fishburne <kevinfishburne at ...1887...>
Date: Sat, 25 Jun 2011 18:45:16
To: <gambas-user at lists.sourceforge.net>
Reply-To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
Subject: Re: [Gambas-user] gb3: Format$
On 06/24/2011 06:42 PM, Benoît Minisini wrote:
>> 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.
That makes perfect sense and was the expected behavior. I'm not sure
what's happening here, but this test code:
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
Produces these results:
1: CDate(t): 06/25/2011 18:35:46.837
2: Format$(CDate(t), "hh:nn:AM/PM"): 06:35:PM
3: CDate(t): 06/25/2011 06:35:46.837
4: Format$(CDate(t), "hh:nn:AM/PM"): 06:35:AM
5: CDate(t): 06/25/2011 06:35:46.837
I checked, and the value of variable "t" is not being changed. However,
after the first Format$, CDate(t) returns a different value than before
the first Format$. Any idea why? Lines 1 and 2 look good, but it seems
like lines 1 and 3 should print the same value. Somehow the Format$ line
continues to have an effect on the subsequent lines.
I hope I'm really not so stupid that I'm missing something obvious. I'm
not even drinking right now!
--
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense..
http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list