The Time data type represents a time (without date).
This type transforms a source value (given value in the model) into a formatted time string and the other way round.
The format patterns must be defined in LDML Date Format notation. For the output, the use of a style ("short, "medium", "long" or "full") instead of a pattern is preferred, as it will automatically use a locale dependent time pattern.
Examples how a Time type can be initialized:
#!js // The source value is given as Javascript Date object. The used output pattern depends on the locale settings (default). var oType = new sap.ui.model.type.Time(); // The source value is given as Javascript Date object. The used output pattern is "hh-mm-ss": e.g. 09-11-27 oType = new sap.ui.model.type.Time({pattern: "hh-mm-ss"}); // The source value is given as string in "hh-mm-ss" format. The used output style is "short". The styles are language dependent. // The following styles are possible: short, medium (default), long, full // This usecase might be the common one. oType = new sap.ui.model.type.Date({source: {pattern: "hh-mm-ss"}, style: "short"}); // The source value is given as string in "hh/mm/ss/SSS" format. The used output pattern is "HH:mm:ss '+' SSS 'ms'": e.g. 18:48:48 + 374 ms oType = new sap.ui.model.type.Time({source: {pattern: "hh/mm/ss/SSS"}, pattern: "HH:mm:ss '+' SSS 'ms'"}); // The source value is given as timestamp. The used output pattern is "HH 'Hours' mm 'Minutes'": e.g. 18 Hours 48 Minutes oType = new sap.ui.model.type.Time({source: {pattern: "timestamp"}, pattern: "HH 'Hours' mm 'Minutes'"}); // The source value is given as string. The used input pattern depends on the locale settings (default). The used output pattern is "hh:mm a": e.g. 06:48 PM oType = new sap.ui.model.type.Time({source: {}, pattern: "hh:mm a"});
The Time type supports the following validation constraints: