S sally3599 Member Licensed User Longtime User Sep 8, 2012 #1 I need to set the DateFormat to yyyy-mm-dd , but the string from DateDialog still uses yyyy-m-d. B4X: Sub Button1_Click Dim Dd As DateDialog Dim thedate As String 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", "Date Dialog", "OK", "Cancel", "", Bmp) thedate = Dd.Year & "-" & Dd.Month & "-" & Dd.DayOfMonth DateTime.DateFormat = "yyyy-mm-dd" Label1.Text= thedate End Sub How can I set the return DateFormat to yyyy-mm-dd from DateDialog? Any help will be appreciate it.
I need to set the DateFormat to yyyy-mm-dd , but the string from DateDialog still uses yyyy-m-d. B4X: Sub Button1_Click Dim Dd As DateDialog Dim thedate As String 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", "Date Dialog", "OK", "Cancel", "", Bmp) thedate = Dd.Year & "-" & Dd.Month & "-" & Dd.DayOfMonth DateTime.DateFormat = "yyyy-mm-dd" Label1.Text= thedate End Sub How can I set the return DateFormat to yyyy-mm-dd from DateDialog? Any help will be appreciate it.
M Mahares Expert Licensed User Longtime User Sep 8, 2012 #2 Use this: B4X: thedate=Dd.Year & "-" & NumberFormat(Dd.month,2,0) & "-" & NumberFormat(Dd.DayOfMonth,2,0) Upvote 0
Use this: B4X: thedate=Dd.Year & "-" & NumberFormat(Dd.month,2,0) & "-" & NumberFormat(Dd.DayOfMonth,2,0)