xsharp.eu • bBrowser time field display
Page 1 of 1

bBrowser time field display

Posted: Fri Nov 08, 2019 12:40 am
by Anonymous
Hi. I'm trying to set the time format to hh:mm tt in a time column within a bbrowser using such methods as:

SetAmPm(false)
SetPMExt(" pm")
SetAMExt(" am")

in the postinit method of the screen on which the bbrowser appears, but nothing makes any difference. How do I get the desired result as shown in the attached screenshot below please?
tempsnip.png
tempsnip.png (42.93 KiB) Viewed 366 times

bBrowser time field display

Posted: Fri Nov 08, 2019 5:49 am
by Jamal
You need to provide an expression codeblock when you add your bDataColumn:

For example:

Code: Select all

oColumn := bDataColumn{SELF:oDCbBrowser1, SELF:oDCbBrowser1:Server,;
		{|oServer, oSelf| , MyFormatTime(oServer:FIELDGET(#JOBTIME)) )}, #Expression, self}
Create a MyFormatTime(sTime as String) function to return the value format you want.

Jamal

bBrowser time field display

Posted: Fri Nov 08, 2019 11:32 pm
by BiggyRat
Thanks so much Jamal.

bBrowser time field display

Posted: Sat Nov 09, 2019 12:07 pm
by robert
Jeff

Code: Select all

SetAmPm(false)
SetPMExt(" pm")
SetAMExt(" am")
This changes global state. You should not do this in an app where more than one window or task can be running at the same time.

Robert

bBrowser time field display

Posted: Sat Nov 09, 2019 12:56 pm
by BiggyRat
Ok. Thanks Robert. It was just used to test the workings of it.

On an unrelated (not in this screen) but related ( in just 2 other screens) I need to specifically put SetDateFormat("dd/MM/yyyy") to make dates appear in the right format in browsers, despite having it in my Start method.. I know 100% that at no point do I manually change date formats, as I have absolutely no reason to, or want to... connected maybe?

bBrowser time field display

Posted: Sat Nov 09, 2019 3:25 pm
by Karl-Heinz
Hi Jeff,

SetAmPm(false) <-- is this just a typo, or are you really using SetAmPm(false) instead of SetAmPm(TRUE) ?
SetPMExt(" pm")
SetAMExt(" am")

In which format is a time stored in your server field ? what does a simple oServer:fieldget ( <yourTimeField> ) show ?

regards
Karl-Heinz