Promotic

ScanDate - method of the Pm object

Description:
Obtains date and time from text value according to the formatting rule.
This method is obsolete (but functional) and it is better to use the PmFormat object (see also PmFormat object formatting string).
Syntax:
Date ScanDate(String sDate, Long nFormatType, [String sFormatValue])
Parameters:
sDate(String) Variable of the String type (date and time)
nFormatType(Long) Format type of date and time.
1 - Saving date and time for example in the form: 2023.10.11 15:23:28.082. Only the order is important. Except for the year the sDate may contain no other data. Any separators may be used (the same way as ScanDate(10, "YomdHMST")).
sFormatValue is not used.
10 - Date and time is stored in sDate as a set of numbers (separated by any character except for numbers).
The sFormatValue contains the order and description of meanings of those numbers.
sFormatValue[optional] (String) Additional information regarding date and time format.
- For nFormatType = 1:
is not used. Don't set.
- For nFormatType = 10:
The order of date/time items in sDate is specified here.
For example: "YmdoHMST", where:
Y=year (e.g. 2023)
m=month (01-12)
d=day (01-31)
H=hour (00-23)
M=minute (00-59)
S=second (00-59)
T=millisecond (000-999)
o=optional: From this item on all other items are optional. For example year, month and day must be defined in sDate but other are optional.

The items may be entered in arbitrary order and in sDate can be separated by any characters except for numbers.
The items may not be separated by any characters (e.g. "20231011152328082"). If so then must be:
- year there must be 4 digits
- month, day, hour, minute, second there must be 2 digits
- millisecond there must be 3 digits
Note:
This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.
This method is also functional in Web panels.
Example:
JavaScriptVBScriptSelect and copy to clipboard

var sDate = "2023.10.11 15:23:28.082";
var tDate = Pm.ScanDate(sDate, 1);

History:
Pm8.03.21: Available for Web panels.. Extended for nFormatType=10 (the input format of date in the form "YmdHMS").
Pm8.02.15: Fixed bug: sometimes milliseconds were evaluated incorrectly.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- LN2
- PI
- Pow
- ScanDate
 
 
- Sin
- Tan
© MICROSYS, spol. s r.o.