iOS Question How do I dynamically create a date picker?

davepamn

Active Member
Licensed User
I need to dynamically create a date picker for a scrollview and then initialize it with a parameter date.
 

davepamn

Active Member
Licensed User
How do I set the date picker using mm/dd/yyyy?

Do you have a function that converts a date into ticks
 

davepamn

Active Member
Licensed User
B4X:
    Dim arrDatePicker(100) As DatePicker

    arrDatePicker(iDatePickerCounter).Mode=arrDatePicker(iDatePickerCounter).MODE_DATE
    DateTime.DateFormat = "MM/dd/yyyy"
    arrDatePicker(iDatePickerCounter).Ticks=DateTime.DateParse(sTestIdValue)
This code worked! I was able to set a date and format to Month, Day, and Year in the Picker Control
 

davepamn

Active Member
Licensed User
this snippet reverses the ticks to a date
B4X:
sTestValue=GetDate(arrDatePicker(i).ticks)

Public Sub GetDate(Ticks As Long) As String

    Dim df As String = DateTime.DateFormat

    DateTime.DateFormat = "MM/dd/yyyy"

    Dim res As String = DateTime.Date(Ticks)

    DateTime.DateFormat = df

    Return res

End Sub
 

gjoisa

Active Member
Licensed User
In other applications there will be done button to dismiss the picker in Iphone . In Ipad if we touch the out side area of picker it will be dismissed . How the do that ?
 
Top