Time Zone in Mobile Apps¶
This page will describe what you need to do to implement time zone for the mobile app. It is only applicable for .offline files.
Known Server - Time Zone¶
First of all, it's important to know that the Known Server - Time Zone is not connected to the TimestampUTC.
With the known server time zone concept, if a data source is annotated as server, it will save all of its timestamp values in UTC in the app client. In other words, all the transactions will be done in UTC.
Example: If an entity A is annotated as a known server in all the online transactions, client will receive all of its timestamp values in UTC. Those values will also be saved as UTC.
In the .offline file, if you are doing a CRUD operation, please make sure that you treat all of its timestamp values as UTC.
@Override
procedure EntityPrepare<A> Structure(A) {
execute {
super(Record) into Record;
call DateTime.TimestampUtc() into Record.RegisterDate;
return Record;
}
}
Use DateTime.TimestampUtc(); instead of DateTime.Timestamp(); otherwise, the data will be corrupted.
Using ODP services¶
Unbound actions/functions¶
If you need to make use of time zone capabilities, an unbound actions/function must be annotated as server.
function A Text {
initialcheck none;
syncpolicy Online;
timestamptzref = "server";
parameter TestInDate Timestamp;
}
Bound actions/functions¶
If the data source is annotated as server all the bound actions and functions will be treated as known server ODP service.
Example: If entity A is annotated all of its bound functions and actions will be treated as known server ODP servicers.