Put up a time and date spinner thing

wheretheidivides

Active Member
Licensed User
Longtime User
I have downloaded the dialog box ad on which has the date and time. I was just wondering why isn't this (and others) not included in the main program?
I mean, the B in BASIC stands for beginner so why not just include them. I spend several hours trying to figure out why this library dialog thing was. Then round out I had to download it, unzip it, move parts to a folder, then rerun the program and then could look at it. Why not just include these libraries in the main program?
================================

question 2: using this code from the library, how fo I figure out the day of the week (like saturday)? I have seen other programs that give the day where 'set the required date" is show. it'll just say 'saturday"

Dim Dd As DateDialog

Dd.Year = DateTime.GetYear(DateTime.Now)
Dd.Month = DateTime.GetMonth(DateTime.Now)
Dd.DayOfMonth = DateTime.GetDayOfMonth(DateTime.Now)

ret = Dd.Show("Set the required date", "B4A Date Dialog", "Yes", "No", "Maybe", Bmp)
ToastMessageShow(ret & " : " & Dd.DayOfMonth & "/" & Dd.Month & "/" & Dd.Year , False)
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Why not just include these libraries in the main program?
Because this specific library was not written by Anywhere Software.

2.
This code will return the day of week as a number, where 1 is Sunday and 7 is Saturday.
B4X:
DateTime.GetDayOfWeek(dd.DateTicks)

You can also set the DateFormat to:
B4X:
DateTime.DateFormat  = "EEEE"
'and then use:
DateTime.Date(Dd.DateTicks)
It will return the day as a string.
 
Upvote 0

wheretheidivides

Active Member
Licensed User
Longtime User
Ok,I figured it out, although I could have used case instead of if-then.

Dim Dd As DateDialog
Dim Day As String
Dim DayNum As Int

Dd.Year = DateTime.GetYear(DateTime.Now)
Dd.Month = DateTime.GetMonth(DateTime.Now)
Dd.DayOfMonth = DateTime.GetDayOfMonth(DateTime.Now)

DayNum = DateTime.GetDayOfWeek(Dd.DateTicks)
If DayNum = 1 Then
Day = "Sunday"
End If
If DayNum = 2 Then
Day = "Monday"
End If
If DayNum = 3 Then
Day = "Tuesday"
End If
If DayNum = 4 Then
Day = "Wednesday"
End If
If DayNum = 5 Then
Day = "Thursday"
End If
If DayNum = 6 Then
Day = "Friday"
End If
If DayNum = 7 Then
Day = "Saturday"
End If

ret = Dd.Show(Day, "B4A Date Dialog", "Yes", "No", "Maybe", Bmp)
ToastMessageShow(ret & " : " & Dd.DayOfMonth & "/" & Dd.Month & "/" & Dd.Year , False)
 
Last edited:
Upvote 0

wheretheidivides

Active Member
Licensed User
Longtime User
So my other question is instead of having the date dialog as a pop up window, how do you put in on a panel? that way the date dialog stays on the screen and doesn't go away?
 
Upvote 0

Jost aus Soest

Active Member
Licensed User
Longtime User
So my other question is instead of having the date dialog as a pop up window, how do you put in on a panel? that way the date dialog stays on the screen and doesn't go away?

You could build your own DatePicker-like control by using 3 Spinner-views for day, month and year.
 
Upvote 0
Top