Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3637

Getting the Current date and time?

$
0
0

I need to have the current date and time from the DesktopDateTimePicker, and I find everywhere I look this code to get it:

Var currentDateTime As DateTime = DateTime.Now

But I get this error:

WinStoryCalendarEvents.butTodayEventDate.Action, line 2
Type "Integer" has no member named "Now"
Var currentDateTime As DateTime = DateTime.Now

Any suggestions how to get the Now date and time?

Update: I got it to work, there was a property set as integer… This is now the working code:

// Initialize the property with the current date and time
Var currentDateTime As DateTime = DateTime.Now

// Set the DateTimePicker to the current date and time
DateTimePickerEvents.SelectedDate = currentDateTime.Now

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 3637

Trending Articles