Hi Guys
I have a little question how i can check the date
.data
.data
stm SYSTEMTIME<>
dateformat db "yyy/MM/dd",0
invoke GetLocalTime, addr stm
invoke GetDateFormat, LOCALE_USER_DEFAULT, NULL, \
addr stm,CTEXT ("yyy/MM/dd"), addr buffer, sizeof buffer
My time format is as example 2009/08/23
Now to the problem :lol:
I need a function for my new toy that i can run all 14 days an Application
I have the old date in a .ini file
Thanks in forward for all information and ideas
Is it run the app once every 14th day? or run for 14 days only?
Ive a function in my datatime library that converts dates to julian dates - a numeric value that you can then apply calculations on
.data?
dwDate1 dd ?
dwDate2 dd ?
.code
;==========================================================================================
; Example to calculate difference in 2 date values over month boundary
Invoke DTDateToJulianMillisec, CTEXT("27/02/2009"), DDMMCCYY
mov dwDate1, eax ; save dword date portion to variable, ignore edx which contains time info
Invoke DTDateToJulianMillisec, CTEXT("03/03/2009"), DDMMCCYY
mov dwDate2, eax ; save dword date portion to variable, ignore edx which contains time info
mov ebx, dwDate1 ; Place date1 in ebx
sub eax, ebx ; subtract date2 from date1, eax = 4 days
;==========================================================================================
; Another example to calculate difference in weeks between 2 date values
Invoke DTDateToJulianMillisec, CTEXT("03/01/2009"), DDMMCCYY
mov dwDate1, eax ; save dword date portion to variable, ignore edx which contains time info
Invoke DTDateToJulianMillisec, CTEXT("10/01/2009"), DDMMCCYY
mov dwDate2, eax ; save dword date portion to variable, ignore edx which contains time info
mov ebx, dwDate1 ; Place date1 in ebx
sub eax, ebx ; subtract date2 from date1, eax = 7 days
xor edx, edx ; clear edx for division
mov ecx, 7d ; Divisor is 7 in ecx
div ecx ; divide eax by 7, eax = 1
for your example the datetime format mask would be YYYYMMDD
The DateTime Library can be found on my site/blog at http://newworldorder.org.uk/fearless/?page_id=74
Thanks
I mean run the app once every 14th day
The 14 is flexible this is not a fixed day
greets
Yes should be possible with the stored last date in your ini, convert it and the current date to julian date and compare, if value is 14 then run, and store new last date, otherwise continue to wait and check.
Hi
Ahh ok I try it :bg
Greets,ragdog
i think that julian-date-stuff will complicate the prg too much.
Julian dates are used in astronomy to span centuries
to check 14 days the DateDiff function in the DateTime-library suits.
The DateTimeLib is in the masm32 pack.
Quote
DateTime Library
Version 1.3
Greg Lyon 2007
A DATETIME is a FILETIME in disguise. It is defined as DATETIME TYPEDEF QWORD. The minimum valid DATETIME is January 1, 1601 12:00:00 AM. The maximum valid DATETIME is December 31, 30827 12:59:59 PM. DATETIME variables should be 8-byte aligned, use ALIGN 8.
.
.
.
DateDiff
This procedure calculates the difference between two DATETIMEs. Returns an SDWORD.