The code is simple:
Var Maintenant As DateTime
System.DebugLog "Maintenant dates, below:"
System.DebugLog Maintenant.SQLDate
System.DebugLog Maintenant.SQLDateTime
In fact, I used Now and no System.DebugLog in a concatenated string saved in a text file, but got a crash.
So I changed Now and used Maintenant (same word, but in French, and tried the code above. I get the same Exception.
But the example below from the docs works file:
Var d As DateTime = DateTime.Now
MessageBox d.SQLDateTime
Last Xojo / Tahoe (French)…
BTW: this crash too
Var Maintenant As DateTime
MessageBox Maintenant.SQLDateTime
It’s not a crash, it’s a NilObjectException. The DateTime variable Maintenant has no value. DateTime.Now returns a class instance representing the current date and time, thus the d variable in your second example has a value. Change your code to:
Var Maintenant As DateTime = DateTime.Now
System.DebugLog "Maintenant dates, below:"
System.DebugLog Maintenant.SQLDate
System.DebugLog Maintenant.SQLDateTime
THANK YOU Anthony !
I must be tired, more tired as I was thinking possible.
The solution was in the Documentation example I read and copy paste above.
I have a meeting with the Eyes Doctor (Ophtalmologiste in French) on 2 month because I really have vision troubles.
How can I read 4 words and skip the end of the line ? I do not understand.
Now, I modify my code.
Checked the Solutions control (lack of memory…)