Android Question MaterialDateTimePicker - How to Get Day of Week?

DonManfred

Expert
Licensed User
Longtime User
As far as i remember there is no such property. But you get the date as long value or not? You can easily use Datetime to get the day of the week.
B4X:
log(Datetime.GetDayOfWeek (tickvalue))

Even if you only get day, month and year you can simple convert the values to a datetime tickvalue.
 
Last edited:
Upvote 0

Uederson Ferreira

Member
Licensed User
Thank you, friend! But I was not able to do it.
The code is:


B4X:
Sub Date_onDateSet(year As Int, monthOfYear As Int, dayOfMonth As Int)
    DateTime.DateFormat = "dd/mm/yyyy"
    d = DateTime.DateParse(dayOfMonth&"/"&(monthOfYear+1)&"/"&year)
    lblData.Text = DateTime.Date(d)
End Sub

I need to get lblData.Text = day_of_week &", "&DateTime.Date(d)

Can you help me please, friend?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub Date_onDateSet(year As Int, monthOfYear As Int, dayOfMonth As Int)
    DateTime.DateFormat = "dd/mm/yyyy"
    Dim d As Long = DateUtils.SetDate(year,monthOfYear,dayOfMonth)
    Dim days() As String = Array As String("","Sunday", "Monday", "Tuesday", "Wednesday","Thursday","Friday","Saturday")
    lblData.Text = days(DateTime.GetDayOfWeek(d))&", "&DateTime.Date(d)
End Sub
 
Upvote 0
Top