Promotic
WikipediaLinkedInYoutubeTwitterFacebook

FormatDate - method of object Pm

Description:
According to the formatting rule (vFormat) it creates a string containing date and time stored in the tDate variable.
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: 2016.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 2016 15:23:28 GMT.
20 - Creates the time in the format suitable for the MS SQL server database: '2016-10-23 15:23:28.082'.
21 - Creates the time in the format suitable for the Oracle database: TIMESTAMP'2016-10-23 15:23:28.082'.
22 - Creates the time in the format suitable for the MySql database: '2016-10-23 15:23:28'.
23 - Creates the time in the format suitable for the Microsoft Access, dBase, PARADOX, etc. databases when setting the direct access, see Direct access to table - DAO, #10 23 2016 15:23:28#.
String type - If the vFormat is of the String type, it is the question of the formatting rule for the time conversion into the string.
Example: "%d.%m.%Y_%H:%M:%S.%T"
d=day (1-31),
m=month (1-12),
Y=year (e.g. 2016),
H=hour,
M=minute,
S=second,
T=millisecond (0-999) - it is possible %nT, where n is count of figures 1, 2 or 3

Any of the formatting chars %d, %m, %Y, %M, ... can be omitted and so to omit the corresponding time item in the presentation.

Note:
The method can also be called in the graphic item events for Web Panels. So far this is functional only for vFormat = String type.
 
PmDateObject.Format is a similar method.
Example1:
Dim sDate, tDate
tDate = Now
sDate = Pm.FormatDate(tDate, "%d.%m.%Y_%H:%M:%S")
  'sDate contains "24.07.2005_17:06:35"
Example2:
Dim sDate, tDate
tDate = Now
sDate = Pm.FormatDate(tDate, "%d.%m.%Y_%H:%M:%S.%2T")
  'sDate contains "24.07.2005_17:06:35.00"
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