Promotic

Format - method of the PmDateObject object

Description:
Creates a text string containing date and time (according to the sFormat formatting rule).
Syntax:
String Format(String sFormat)
Parameters:
sFormat(String) Formatting rule for the date and time conversion into the string.
Example: "%d.%m.%Y_%H:%M:%S.%T", where:
d=day (01-31),
m=month (01-12),
Y=year (e.g. 2023),
H=hour (00-23),
M=minute (00-59),
S=second (00-59),
T=millisecond (000-999) - it is possible %nT, where n is count of digits 1, 2 or 3

Any of the chars %d, %m, %Y, %M, ... can be omitted and so to omit the corresponding time item in the presentation.
Note:
Examples of commonly used formats:
%Y.%m.%d %H:%M:%S.%3T - The internal way of date and time storing in the PROMOTIC system is in the form of 2023.10.11 15:23:28.082. This way ensures that the strings are sorted in compliance with the date and time sorting.
'%Y-%m-%d %H:%M:%S.%3T' - Creates the time in the form suitable for the MS SQL database: '2023-10-23 15:23:28.082'.
TIMESTAMP'%Y-%m-%d %H:%M:%S.%3T' - Creates the time in the form suitable for the Oracle database: TIMESTAMP'2023-10-23 15:23:28.082'.
'%Y-%m-%d %H:%M:%S' - Creates the time in the form suitable for the MySQL database: '2023-10-23 15:23:28'.
#%d %m %Y %H:%M:%S# - Creates the time in the form suitable for the Microsoft Access, dBase, PARADOX, etc. on setting the direct access, see Direct access to table - DAO, #10 23 2023 15:23:28#.


This method is also functional in Web panels.
See also:
- Pm.FormatDate (method)
Example:
JavaScriptSelect and copy to clipboard

var oDate = Pm.CreatePmDateObject();
var sDate = oDate.Format("%d.%m.%Y_%H:%M:%S.%2T");
// sDate contains for example "24.07.2023_17:06:35.00"

History:
Pm8.02.00: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.