Hi all,
I'm using a B4XOrderedMap object (by @Erel) and a list in order to implement a sort using a date field that I got from a remote server (REST API).
The field has this data and format:
- Format: Y-m-d\TH:i:sP
- Data (data field content): 2020-04-26T12:36:07+00:00
See the relevant code:
In this way I sort only by date, but how to obtain a full timestamp using the downloaded date time: 2020-04-26T12:36:07+00:00 ?
I need to sort the list by timestamp or al least by YYYY-MM-DD-HH-MM.
What is the simple and quick way to obtain a full time stamp or a partial timestamp (YYYY-MM-DD-HH-MM) using "2020-04-26T12:36:07+00:00" (Format: Y-m-d\TH:i:sP) ?
Thanks in advance for your help
Luca.
I'm using a B4XOrderedMap object (by @Erel) and a list in order to implement a sort using a date field that I got from a remote server (REST API).
The field has this data and format:
- Format: Y-m-d\TH:i:sP
- Data (data field content): 2020-04-26T12:36:07+00:00
See the relevant code:
B4X:
'Class Globals
Public mapArtIMGs As B4XOrderedMap
Sub GetArtContent (nid As Int, aUser As String, aPsw As String) As ResumableSub
'Here I read the date time field from the JSON data
Dim CFullDate As String = colchanged.Get("value") '--> this contains "2020-04-26T12:36:07+00:00"
Dim HDate As String = CFullDate.SubString2 (0, 10) '--> In this way I got only the date substring used within the sort
End sub
Public Sub LoadArtList (ArtContent As B4XOrderedMap)
Private lstArt As List = ArtContent.Values
lstArt.SortType("HDate", False) ---> Apply sort on HDate ("2020-04-26")
For i=0 To lstArt.Size-1
'....
mapArtIMGs.Put(target_id, Item)
'....
Next
Return mapArtIMGs
End Sub
In this way I sort only by date, but how to obtain a full timestamp using the downloaded date time: 2020-04-26T12:36:07+00:00 ?
I need to sort the list by timestamp or al least by YYYY-MM-DD-HH-MM.
What is the simple and quick way to obtain a full time stamp or a partial timestamp (YYYY-MM-DD-HH-MM) using "2020-04-26T12:36:07+00:00" (Format: Y-m-d\TH:i:sP) ?
Thanks in advance for your help
Luca.