ScanDate - method of the Pm object
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: 2024.10.11 15:23:28.082. Only the order is important. Except for the year the sDate may contain no other data. Any separators can 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. 2024)
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 can 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. " 20241011152328082"). 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 |
---|
Example:
JavaScriptVBScriptSelect and copy to clipboard
var sDate = "2024.10.11 15:23:28.082";
var tDate = Pm.ScanDate(sDate, 1);
Dim sDate
sDate = "2024.10.11 15:23:28.082"
Dim tDate
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.