[code] Dim theDate as New Date
Dim converted as Boolean
converted = ParseDate( arrVar(7), theDate)
IF converted THEN
System.DebugLog CurrentMethodName + " :: " + theDate.AbbreviatedDate
'JOLT.dteSubscriptionEnd = theDate.AbbreviatedDate
JOLT.dteSubscriptionEnd = theDate.SQLDateTime
If you want to create a class that can be compared to something else, you implement the Operator_Compare method. This will let you do things like if myClass1 > myClass2 then . You don’t have to call Operator_Compare directly.
Some of the native classes, like Date, already implement that, so this is perfectly valid:
if someDate > someOtherDate then
In your original code, you tried to compare a date to a string (if JOLT.dte > dteToday.SQLDate), and that won’t work. Instead, you could simply do this:
if JOLT.dteSubscriptionEnd > dteToday then
or this:
if JOLT.dteSubscriptionEnd.SQLDate > dteToday.SQLDate
If you are only interested in the date, not the time, use the second version.
Thank you for the input!
Thank you for the seconds, in this case the date, the day, will be good enough. But in other cases, seconds may be needed. It’s true!
The value is empty, to start with.
Why are there constant errors when trying alternatives such as NOT NIL and plenty alternatives!?
[code] ’ ## ONLY VALID FOR SUBSCRIBING MEMBERS
DIM dteToday as New Date
IF JOLT.dteSubscriptionEnd <> “” THEN
IF JOLT.dteSubscriptionEnd > dteToday THEN
MsgBox “hello world!!”
END IF
END IF[/code]
Thank you very much for the post!
That last line I also tried. How would you know!?
In general, my personal way of solving problems is sometimes simply to remove the problem, to look on another, maybe less fancy and attractive, but at least working solution.
JOLT.bolSubscriber was the case at this time:
' ## INSERT SUBSCRIBER DATE FOR USER
DIM dteEnd as New Date
DIM bolDte as boolean
bolDte = ParseDate(arrVar(7), dteEnd)
IF bolDte = TRUE THEN
DIM d as New Date
IF dteEnd >= d THEN JOLT.bolSubscriber = TRUE ELSE JOLT.bolSubscriber = FALSE
END IF
I really miss dateAdd and dateDiff from Classic ASP…!
<%
IF JOLT.dteSubscriberEnd >= date() THEN btnSave.Enable = TRUE
%>
This is only imaginary code, but in this case, the date, REALbasic really differ from Visual Basic. (VB Script that is.)
Oh well! It’s the way it is! Just my thoughts!
well that’s the difference between Visual Basic’s pseudo OOP and real OOP in xojo. You would run into same problem with other stricter languages too. Make yourself more familiar with data types and OOP.