In PB we have the following code that can do this future date
#COMPILE EXE
#INCLUDE "win32api.inc"
' Increment Time.bas
TYPE ScottsDateTime
dwLowDateTime AS DWORD
dwHighDateTime AS DWORD
END TYPE
UNION QuadFILETIME
dwDateTime AS ScottsDateTime
qdTime AS QUAD
END UNION
'===========================================
FUNCTION PBMAIN() AS LONG
LOCAL iMinutes AS LONG
? " Current Date and Time : " + GitCurDateTime ,, "Current Date and Time"
' you could also use a negative value here to subtract time from
' the current system date and time.
iMinutes = 720 ' 12 * 60 ' Increment 12 hours
MSGBOX SetNextCheckTime(iMinutes) ,, " 12 hours ahead "
iMinutes = 30 * 24 *60 ' 30 days ahead in minutes
MSGBOX SetNextCheckTime(iMinutes) ,, " 30 days ahead "
END FUNCTION
'=================================================
' This function does the same thing as
' GetPCTimeAndDate except uses the input SYSTEMTIME structure
FUNCTION FormatTime(st AS SYSTEMTIME, TimeFormat AS STRING, DateFormat AS STRING) EXPORT AS STRING
LOCAL tTime AS ASCIIZ * 64
LOCAL tDay AS ASCIIZ * 64
IF LEN(TimeFormat) = 0 THEN TimeFormat = "hh':'mm':'ss tt"
IF LEN(DateFormat) = 0 THEN DateFormat = "dddd',' MMMM dd'ø' yyyy"
GetTimeFormat 0,0, st, BYVAL STRPTR(TimeFormat), tTime, 64
GetDateFormat 0,0, st, BYVAL STRPTR(DateFormat), tDay, 64
FUNCTION = tDay + " " + tTime
END FUNCTION
'=================================================
' This function does the same thing as
' GetPCTimeAndDate except uses the input SYSTEMTIME structure
FUNCTION SpFormatTime(st AS SYSTEMTIME, TimeFormat AS STRING, DateFormat AS STRING) EXPORT AS STRING
LOCAL tTime AS ASCIIZ * 64
LOCAL tDay AS ASCIIZ * 64
IF LEN(TimeFormat) = 0 THEN
TimeFormat = "hh':'mm':'ss tt"
END IF
IF LEN(DateFormat) = 0 THEN
DateFormat = "dddd',' MMMM dd'ø' yyyy"
END IF
GetTimeFormat 0,0, st, BYVAL STRPTR(TimeFormat), tTime, 64
GetDateFormat 0,0, st, BYVAL STRPTR(DateFormat), tDay, 64
FUNCTION = tDay + " " + tTime
END FUNCTION
'=================================================
FUNCTION GitCurDateTime AS STRING
LOCAL syst AS SYSTEMTIME
' Get the current time
CALL GetlocalTime(syst)
' When you need the date in MM-dd-yyyy format
'FUNCTION = spFormatTime(syst, "hh':'mm':'ss tt", "MM-dd-yyyy")
' When time is up to secs format
'FUNCTION = spFormatTime(syst, "hh':'mm':'ss tt", "yyyy-MM-dd")
' When time is up to min format
FUNCTION = spFormatTime(syst, "hh':'mm tt", "yyyy-MM-dd")
END FUNCTION
'==============================================
FUNCTION IncrSystemTime(st AS SYSTEMTIME, BYVAL IncrValue AS LONG) EXPORT AS LONG
DIM QT AS QuadFILETIME
' NOTE IncrValue would always need to be in seconds
' for the rest of this to work
' Convert to QUAD time
CALL SystemTimeToFileTime(ST, QT)
' FileTime returns 100's of NANOSECONDS so you have to adjust
' **** IncrValue * 10000000 to convert to Nanoseconds
' Now Add the delay To the Quad-element that overlay the FILETIME-struct
QT.qdTime = QT.qdTime + (IncrValue * 10000000)
' Convert back To SYSTEMTIME
FileTimeToSystemTime QT, ST
END FUNCTION
'=================================================
FUNCTION SetNextCheckTime(MinutesToAdvance AS LONG) AS STRING
LOCAL iSeconds AS LONG
LOCAL st AS SYSTEMTIME
LOCAL QT AS QuadFILETIME
' Get the current time
CALL GetlocalTime(st)
' this would always be zero
'db = (MinutesToAdvance \ 60) \ 10000
' *** fixed *** change minutes to seconds
iSeconds = (MinutesToAdvance * 60)
CALL IncrSystemTime(st, iSeconds)
FUNCTION = FormatTime(st, "hh':'mm':'ss tt", "MM-dd-yyyy")
END FUNCTION