unfortunately I have an irritating problem with the way DateTimePicker works. It returns a value of the type “DateTime”. And I should be able to convert this value into a string just as easily as Visual Basic does. But that does not work. It doesn’t work with the variant with “…SelectedDate.toString” as well as with the variant “…SelectedDate.SQLDateTime” if I want to write the date in the window title after selecting it. What am I doing wrong? I try to add a screenshot here.
Thanks in advance for helpful hints,
The Value is provided as a parameter, so:
WinTimes.Title = Value.SQLDateTime
Thank you very, very much. : -)
I was already desperate. When you haven’t worked with Xojo for a long time, you get mixed up with some things.
Now everything is right again. Only one more question: What has become of the Date() class? Or do I mix up there the Basic dialects again?
Thank you and nice greeting,
Date is still around, albeit deprecated. The new DateTime class has better handling of time zones and things like daylight savings than date ever did.
Once we deploy our 2020r2.1 release you’ll be able to use
SelectedDate too if you want to do it that way, even if you get
Value as the parameter for the event. (Not been able to operate on SelectedDate was a bug in 2020r2.)
That is good to know. Because I did not get over this “SelectedDate” threshold. Mainly because it seems to work with the DatePicker in a web application with this reference.
Yeah, the main difference there (web) is that you aren’t receiving the selected date already as parameter in the Event; so in the case of Desktop, it would make more sense to rely in the already received “
Anyway, you’ll be able to do it also using SelectedDate!
I take note of this with pleasure. In general, I find it impressive how many improvements are brought into the development in a short time. But since I continue with PureBasic, SpiderBasic, VB.Net and VBA among others, the language references get mixed up.
When I use: DateTimePicker1.SelectedDate.ToString, I get the whole “19 Dec 2020 at 9:45:16 am” string , even when I am only displaying the date on the dateTimePicker field. Is there some way to force just the date to be entered without using substring prior to storing the data?
Gives just the date in SQL format as a text
var d as String = DateTimePicker1.SelectedDate.SQLDate