Hi all,
reading the B4X DateUtils Tutorial from @Erel (https://goo.gl/R7NcFC) I'm trying to understand how to modify my code in order to select items created within a period.
Actually I select (query) the KVS Cloud items using this code:
With this code I have all created items within the today date.
How to have the today date order plus orders created the previous day within a specific time window (x hours).
With the above code I got all the items created from 15/11/2017 00:00 to 15/11/2017 23:59.
How to get also the items created (Date) between 14/11/2017 XX:00 and 14/11/2017 23:59 ?
The problem is that my user need to see also the items created the day before (x hours near the midnight) when the day switch to the new day (because he must work on this items also in the first hours of the new day).
Thanks in advance for your help.
reading the B4X DateUtils Tutorial from @Erel (https://goo.gl/R7NcFC) I'm trying to understand how to modify my code in order to select items created within a period.
Actually I select (query) the KVS Cloud items using this code:
B4X:
'Each item is a type (Order) and have a field (property) named "Date" that is filled on item creation
'Item creation...
Private TodayDateInTicks as long = DateTime.DateParse (DateTime.Date(DateTime.Now))
NewOrder.Date = Starter.TodayDateInTicks
....
'Query items by today date
Private lstOrders As List
lstOrders.Initialize
Private items As Map = GetAll (aUserKey)
For Each o As Object In items.Values
If o Is Order Then
Private Ord As Order = o
If Ord.Date = Starter.TodayDateInTicks Then
lstOrders.Add(Ord)
End If
End If
Next
With this code I have all created items within the today date.
How to have the today date order plus orders created the previous day within a specific time window (x hours).
With the above code I got all the items created from 15/11/2017 00:00 to 15/11/2017 23:59.
How to get also the items created (Date) between 14/11/2017 XX:00 and 14/11/2017 23:59 ?
The problem is that my user need to see also the items created the day before (x hours near the midnight) when the day switch to the new day (because he must work on this items also in the first hours of the new day).
Thanks in advance for your help.
Last edited: