Promotic
WikipediaLinkedInYoutubeTwitterFacebook

FormatDate - method of object Pm

Description:
Creates a text string containing date and time (according to the vFormat formatting rule).
Syntax:
FormatDate(tDate As Date, vFormat As Variant) As String
Calling:
s = Pm.FormatDate(tDate, vFormat)
Parameters:
tDate(Date) variable of the Date type (it holds the date and time)
vFormat(Variant) Type of the pre-defined conversion or formatting rule for the date and time conversion into the string. If the vFormat is of a numeric type, then the number is understood as the type of the pre-defined conversion.
1 - The internal way of the date and time storing in the PROMOTIC system is in the form: 2018.10.23 15:23:28.082. This way ensures that the strings are sorted in compliance with the date and time sorting.
2 - Creates the time in the Internet format: Tue, 04 Jan 2018 15:23:28 GMT.
String type - If the vFormat is of the String type, then it is the formatting rule for the 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. 2018),
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 figures 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.

20 - Obsolete. Creates the time in the format suitable for the MSSQL database: '2018-10-23 15:23:28.082'.

It is better to use string type with value: '%Y-%m-%d %H:%M:%S.%T'.

21 - Obsolete. Creates the time in the format suitable for the Oracle database: TIMESTAMP'2018-10-23 15:23:28.082'.

It is better to use string type with value: TIMESTAMP'%Y-%m-%d %H:%M:%S.%T'.

22 - Obsolete. Creates the time in the format suitable for the MySQL database: '2018-10-23 15:23:28'.

It is better to use string type with value: '%Y-%m-%d %H:%M:%S'.

23 - Obsolete. Creates the time in the format suitable for the Microsoft Access, dBase, PARADOX databases when setting the direct access: #10 23 2018 15:23:28#.

It is better to use string type with value: #%m %d %Y %H:%M:%S#.

Note:
The method can also be called in the graphic item events for Web panels. So far this is functional only for: vFormat = 1 and vFormat = String type.
 
PmDateObject.Format is a similar method.
Example1:
JavaScriptVBScriptSelect and copy to clipboard

var tDate = Pm.Time;
var sDate = Pm.FormatDate(tDate, "%d.%m.%Y_%H:%M:%S");
//sDate contains "24.07.2017_17:06:35"
Example2:
JavaScriptVBScriptSelect and copy to clipboard

var tDate = Pm.Time;
var sDate = Pm.FormatDate(tDate, "%d.%m.%Y_%H:%M:%S.%2T");
//sDate contains "24.07.2017_17:06:35.63"
PROMOTIC 8.3.27 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- FormatDate
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice