Android Question Formatting column in B4XTable

Mario Krsnic

Member
Licensed User
Hello!
I habe two columns in the B4XTable, one for the date data and the second for the time data. Wenn I set DateTime.DateFormat="dd.MM.yyyy" and try to load the table then I get in both columns date values. If I set DateTime.DateFormat="HH:mm" then I get in both columns time values. How can I get date AND time values?
Thank you for your help!
Mario

Here my code:

B4X:
Sub Activity_Create(FirstTime As Boolean)

'Do not forget to load the layout file created with the visual designer. For example:

Activity.LoadLayout("tabelle")

Activity.Title="Protocolo"


Try

DateTime.DateFormat="dd.MM.yyyy"


Dim DateColumn As B4XTableColumn = B4XTable1.AddColumn("Data", B4XTable1.COLUMN_TYPE_DATE)

DateColumn.Width = 90dip



Dim TimeColumn As B4XTableColumn = B4XTable1.AddColumn("Tiempo", B4XTable1.COLUMN_TYPE_DATE)

TimeColumn.Width = 90dip

FillTable


Catch LastException

MsgboxAsync ( LastException.Message,"error" )

End Try

end sub


Sub FillTable

Try

DateTime.DateFormat="dd.MM.yyyy"


Dim Data As List

Dim rs As ResultSet

Private Query As String


Data.Initialize



Query = "SELECT Data, Tiempo from protocol "

rs = Starter.SQL1.ExecQuery(Query)

Do While rs.NextRow

Dim row(2) As Object


row(0) = rs.GetString("Data")

row(1) = s.GetString("Tiempo")

Data.Add(row)

Loop

rs.Close

B4XTable1.SetData(Data)

Catch LastException

MsgboxAsync ( LastException.Message,"Error" )

End Try

End Sub
 
Last edited:
Top