en:software:qview:qview_6:qcl_library:vc10mktime

This translation is older than the original page and might be outdated. See what has changed.

VC10MkTime

Introducing a date and time (day, mounth, year, hours, minutes, seconds) the VC10MkTime function gives the number of seconds elapsed from 00:00 of the 1 January 1970 until the introduced date.
This is useful to be able to make comparisons between dates.
The function also runs day and month values greater than its natural limits (day > 31 or mounth > 12), automatically calculating the date.

VC10MkTime (aglParam, glSumSec)

Parameters:

IN/OUTVARIABLE TYPEEXAMPLE NAMEDIM
IN ARRGBL aglParam[01] L Day [>0]
IN ARRGBL aglParam[02] L Month [>0]
IN ARRGBL aglParam[03] L Year [1970÷2037]
IN ARRGBL aglParam[04] L Hour [0÷23]
IN ARRGBL aglParam[05] L Minutes [0÷59]
IN ARRGBL aglParam[06] L Seconds [0÷59]
OUT ARRGBL aglParam[07] L Day of the week:
0 = sunday
1 = monday
2 = tuesday
3 = wednesday
4 = thursday
5 = friday
6 = saturday
OUT ARRGBL aglParam[08] L Number of days gone by than the 1 January of the year introduced
OUT ARRGBL aglParam[09] L Error type:
0 = No
1 = Day ≤ 0
2 = Month ≤ 0
3 = Year introduced off limits [1970÷2037]
OUT GLOBAL glSumSec L Sum of seconds elapsed from 00:00 of 1 January 1970 until date introduced

Example

You want to activate a digital output (ofUscita01) When the date and current time exceeds a previously set date and time.

;Current Date
aglParam[1] = 25
aglParam[2] = 6
aglParam[3] = 2009
aglParam[4] = 15
aglParam[5] = 30
aglParam[6] = 55
VC10MkTime (aglParam, glSumSec)
glSecActual = glSumSec			;Value in seconds of the current date
 
;Data to compare
aglParam[1] = 1
aglParam[2] = 1
aglParam[3] = 2010
aglParam[4] = 18
aglParam[5] = 00
aglParam[6] = 00
VC10MkTime (aglParam, glSumSec)
glSecExpiry = glSumSec			;Value in seconds of the expiration date
 
IF glSecActual GT glSecExpiry
	SETOUT ofUscita01
ENDIF

Operation notes

  • By setting a month value greater than 12 function calculates the date and place it in the year or in subsequent years in relation to that introduced (example: 10/14/2010 will match the date 10/2/2011)
  • By setting a day value greater than the number of days supported by the set month, the function calculates the time and place it in the month or in the following months than that introduced (example: 50/5/2010 will match the date 19/6/2010)
  • Last modified: 2019/08/29 17:01