newdate=Date(1998,12,12,14,22,36)
Debug FormatDate("%yyyy %mm %dd %hh %ii %ss",newdate)
newdate=AddDate(newdate,#PB_Date_Year,0)
newdate=AddDate(newdate,#PB_Date_Month,0)
newdate=AddDate(newdate,#PB_Date_Day,0)
newdate=AddDate(newdate,#PB_Date_Hour,0)
newdate=AddDate(newdate,#PB_Date_Minute,0)
newdate=AddDate(newdate,#PB_Date_Second,0)
Debug FormatDate("%yyyy %mm %dd %hh %ii %ss",newdate)
What is wrong with this code? I don't add anything to the date and still it is not the same before and after the operations?
Regards,
Gantry
Problem with date functions
Problem with date functions
*** In the end we will remember not the words of our enemies, but the silence of our friends. (Martin Luther King Jr.) ***
Weird, further investigation reveals that these two line subtracts one hour each from the date:
Maybe you should post this in bug section on this forum instead?
Code: Select all
; ...
newdate=AddDate(newdate,#PB_Date_Year,0)
newdate=AddDate(newdate,#PB_Date_Month,0)
; ...
Yes, I see the same strangeness here with XP and PB 3.71 Beta 2..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
-
- User
- Posts: 50
- Joined: Fri Apr 25, 2003 7:21 pm
- Location: The World is my country, all mankind are my brethren, and to do good is my religion.
- Contact:
A work around.
I ran into this problem a little while ago too.
I didn't know if it was a bug, or I was doing something wrong.
As a work around, I just did all date math in the form of seconds.
You may well know that the Date() function returns a Long integer containing the date in seconds. In order to do any date math you can simply add/subtract the amount in seconds.
I.E.
Hope this helps with your problem until Fred can get this bug nailed down.
-Jim
I didn't know if it was a bug, or I was doing something wrong.
As a work around, I just did all date math in the form of seconds.
You may well know that the Date() function returns a Long integer containing the date in seconds. In order to do any date math you can simply add/subtract the amount in seconds.
I.E.
Code: Select all
NewDate.l = Date(1998,12,12,14,22,36)
Debug FormatDate("%yyyy %mm %dd %hh %ii %ss",NewDate)
;Add One Day to New Date
NewDate + (3600 * 24); 3600 seconds in one hour * 24 hours
Debug "One Day Later: " + FormatDate("%yyyy %mm %dd %hh %ii %ss",NewDate)
;Add One Week to New Date
NewDate + (86400 * 7); 86400 seconds in one day * 7 days
Debug "One Week Later: " + FormatDate("%yyyy %mm %dd %hh %ii %ss",NewDate)
-Jim