Android Question How to get dayoftheweek ?

G-ShadoW

Active Member
Licensed User
Longtime User
Hello, how to get picked dayoftheweek from calendar?

B4X:
Dim td As TimeDialog
    Dim today As Long
   
    DateTime.DateFormat = "dd.MM.yyyy"

    Dim dd As DateDialog
    dd.ShowCalendar=True
    dd.Year=DateTime.GetYear(DateTime.Now)
    dd.Month=DateTime.GetMonth(DateTime.Now)
    dd.DayOfMonth=DateTime.GetDayOfMonth(DateTime.Now)
   
   
    td.Hour= DateTime.GetHour(DateTime.Now)
    td.Minute=DateTime.GetMinute(DateTime.Now)
    td.Is24Hours=True

   If dd.Show("Day of trip","Select date","OK","","Cancel",Null)=DialogResponse.POSITIVE Then
    today=dd.DateTicks
    NumberFormat(dd.Month,2,0)
    EditText3.Text=NumberFormat (dd.DayOfMonth,2,0) & "." & NumberFormat(dd.Month,2,0) & "." & dd.Year
    Log("today: " & today)
    End If

I can get today's date, but not picked from calendar...

B4X:
Dim hour As String
Dim date As String
DateTime.TimeFormat = "HH"
hour=DateTime.Time(DateTime.Now)
date=DateTime.GetDayOfWeek(DateTime.Now)
 

klaus

Expert
Licensed User
Longtime User
B4X:
DayOfWeek = DateTime.GetDayOfWeek(dd.DateTicks)
From the help:
Returns the day of week component from the ticks value.
Values are between 1 to 7, where 1 means Sunday.
You can use the AHLocale library if you need to change the first day.
 
Upvote 0
Top