Promotic
WikipediaLinkedInYoutubeTwitterFacebook

GetDateOf - method of object Pm

Description:
Derive dates from defined base date.
Syntax:
GetDateOf(nOper As Long, [tDate As Date], [nPar1 As Long], [nPar2 As Long]) As Date
Calling:
t = Pm.GetDateOf(nOper, tDate, nPar1, nPar2)
Parameters:
nOper(Long) Operation over the entered time.
1 - Conversion of the tDate input time type into the standard time or daylight-saving time. See Example1.

The nPar1 parameter defines the type of the input time and nPar2 defines the type of the output time.

0 = An automatic time. Automatic selection of the time type according to the current time period. I.e. in the daylight-saving time period, the "daylight-saving time" will be selected. In case of a standard time period, then the "standard time" will be selected.
1 = standard time.
2 = daylight-saving time.
11 - Time of application launch. The tDate parameter is not entered.

Parameters nPar1 and nPar2 are not used.

21 - Beginning of daylight-saving time in the year of the entered time. See Example2.

Parameters nPar1 and nPar2 are not used.

22 - Beginning of standard (winter) time in the year of the entered time.

Parameters nPar1 and nPar2 are not used.

23 - Beginning of daylight-saving time after the entered time.

Parameters nPar1 and nPar2 are not used.

24 - Beginning of standard (winter) time after the entered time.

Parameters nPar1 and nPar2 are not used.

25 - Beginning of daylight-saving time before the entered time.

Parameters nPar1 and nPar2 are not used.

26 - Beginning of standard (winter) time before the entered time.

Parameters nPar1 and nPar2 are not used.

27 - The closest pass after the entered time.

Parameters nPar1 and nPar2 are not used.

28 - The closest pass before the entered time.

Parameters nPar1 and nPar2 are not used.

41 (61,81) - Beginning of the (past, next) year.

Parameters nPar1 and nPar2 are not used.

42 (62,82) - Beginning of the (past, next) quarter. This can also be solved by the operation 43 (63,83) - see Example4.

Parameters nPar1 and nPar2 are not used.

43 (63,83) - Beginning of the (past, next) month. See Example3 and Example4.

Parameter nPar1 defines the size of time block (see Meaning of nPar1 parameter for time block operations). The parameter nPar2 is not used.

44 (64,84) - Beginning of the (past, next) week (Monday is the first day of the week).

Parameters nPar1 and nPar2 are not used.

45 (65,85) - Beginning of the (past, next) day.

Parameters nPar1 and nPar2 are not used.

46 (66,86) - Beginning of the (past, next) hour. See Example5 and Example6.

Parameter nPar1 defines the size of time block (see Meaning of nPar1 parameter for time block operations). The parameter nPar2 is not used.

47 (67,87) - Beginning of the (past, next) minute.

Parameter nPar1 defines the size of time block (see Meaning of nPar1 parameter for time block operations). The parameter nPar2 is not used.

48 (68,88) - Beginning of the (past, next) second.

Parameter nPar1 defines the size of time block (see Meaning of nPar1 parameter for time block operations). The parameter nPar2 is not used.

101 (121,141) - The last day of the (past, next) year.

Parameters nPar1 and nPar2 are not used.

102 (122,142) - The last day of the (past, next) quarter.

Parameters nPar1 and nPar2 are not used.

103 (123,143) - The last day of the (past, next) month.

Parameters nPar1 and nPar2 are not used.

104 (124,144) - The last day of the (past, next) week (Sunday is the last day of the week).

Parameters nPar1 and nPar2 are not used.

105 (125,145) - The last hour of the (past, next) day.

Parameters nPar1 and nPar2 are not used.

106 (126,146) - The last minute of the (past, next) hour.

Parameters nPar1 and nPar2 are not used.

107 (127,147) - The last second of the (past, next) minute.

Parameters nPar1 and nPar2 are not used.

tDate[optional] (Date) Entered time. If the parameter is omitted (or the entered value is 0) then the current time is used as preset.
nPar1[optional] (Long) The meaning depends on the operation (on nOper parameter).

For operations that do not use this parameter, the patrameter is omitted, or the 0 value is entered.

nPar2[optional] (Long) The meaning depends on the operation (on nOper parameter).

For operations that do not use this parameter, the patrameter is omitted, or the 0 value is entered.

Note:
The method can also be called in the graphic item events for Web Panels. Only operations 41 - 88 are currently functional for web.
 
Meaning of nPar1 parameter for time block operations:

For operations 43,63,83 (beginning of month), 46,66,86 (beginning of hour), 47,67,87 (beginning of minute) and 48,68,88 (beginning of second) the nPar1 parameter can be used to define block so the result will not be the beginning of a mont (hour, minute, second), but a beginning of block nPar1 of months (hours, minutes, seconds).

- Example for month: If nPar1 = 3 then the result will be the beginning of the three-month block (i.e. a beginnig of quarter) - see Example4.
- Example for hour: If nPar1 = 8 then the result will be the beginning of 8-hour block (i.e. beginning of a shift) - see Example6. For example the shift starts at 6am every day then it is necessary to subtract 6 hours from the entry time and then add the 6 hours to the result (6 hours means 6/24).
Example1:
Getting the current time in the daylight-saving time (even if the active "daylight-saving time" can be now)
Dim d
d = Pm.GetDateOf(1,0,0,1)
Example2:
Getting the pass time to "daylight-saving time" in 2016 year
d = Pm.GetDateOf(21, Pm.CreateDate(2016,1,1, 0,0,0,0))
Example3:
Detection of beginning of the current month
d = Pm.GetDateOf(43, 0)
Example4:
Detection of beginning of this quarter (i.e. a 3-month block) - see Meaning of nPar1 parameter for time block operations
d = Pm.GetDateOf(43, 0, 3)
Example5:
Detection of beginning of this hour
d = Pm.GetDateOf(46, 0)
Example6:
Detection of beginning of this shift. The shift is represented by a 8-hour block that begins at 6am. Therefore in the example 6 hours (i.e. the value 6/24) are subtracted from the entry time and then added to the output time.. See Meaning of nPar1 parameter for time block operations
d = Pm.GetDateOf(46, Pm.Time - 6/24, 8) + 6/24
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- GetDateOf
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice