Welcome! Log In Create A New Profile

Advanced

[WX24] Dates Solved!

Posted by gpredl 
[WX24] Dates Solved!
June 16, 2019 12:57PM
Hi,

not long ago, one could handle dates like strings and strings like dates - as long as their internal builds were like YYYYMMDD

Now, they do not accept a string as a date and they don't accept a date as a string.

Lots of errors, lots of work ...

-----------------

Info: My Error: DateToInteger(..) has been fed with an empty date which causes an error now, but did not so before.

Kind regards,
Guenter Predl
office@windev.at



Edited 2 time(s). Last edit at 06/16/2019 05:30PM by gpredl.
Re: [WX24] Dates
June 16, 2019 02:52PM
Just looked at a spot of code that deals with this issue. Still works for me in version 24.

modtime1 is string =TimeToString(TimeSys(),"HH:MM AP")
modtime is string =DateToString(Today() , "MM-DD-YYYY")
modtimecomb is string = modtime + " " + modtime1

Also, your example is "YYYMMDD". 3 digit year?

Regards,
JimC



Edited 1 time(s). Last edit at 06/16/2019 03:26PM by JCarson.
Re: [WX24] Dates
June 16, 2019 04:30PM
Hi, no, it's just a typo, should read YYYYMMDD

Date arithmetics is not anymore what it used to be. Worked fine for many years, but

WithIn a procedure:

Procedure(PxInputDate is string, PxOutputDate is string, PxDays is 4-byte int ...)

MyInputDate is Date = StringToDate(PxInputDate,"YYYYMMDD") <= works
MyOutputdate is Date = IntegerToDate( (DateToInteger(MyInputDate) + PxDays) ) <= Error! Says: A Date must be an 8-digit string!

This one works:
MyOutputdate is Date = IntegerToDate( (DateToInteger(StringToDate(MyInputDate,"YYYYMMDD")) + PxDays) )

While dates and strings in correct format ("YYYYMMDD") could be freely intermixed until version 23, they insist on correct typing in v24 !

The funny thing (= ERROR) is that MyInputDate is already typed as a Date and needs a re-conversion from string to date in order to work correctly with DateToInteger(..) function!

Kind regards,
Guenter Predl
office@windev.at



Edited 4 time(s). Last edit at 06/16/2019 05:04PM by gpredl.
Re: [WX24] Dates Solved!
June 18, 2019 10:17AM
Hi Guenter,
the "assign issue" has been in WEBDEV at least since v21.
This was never a problem with WINDEV 21 - looks like PCSoft is adding this "feature" in newer versions of WINDEV also.
Probably because it makes "immigration" from WINDEV to WEBDEV a lot easier.

Regards
Steven Sitas
Al
Re: [WX24] Dates Solved!
June 18, 2019 11:08AM
Hello,

I have a simple way of using dates in relation to the DateToInteger() function. I always test the date value with the DateValid() function before attempting to pass it to the DateToInteger() function.

Regards
Al
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: