Is there any way I can convert a date of format: dd/mm/yyyy to yyyymmdd format? For example from : 25/07/2011 to 20110725? in VB.NET?
Is there any way I can convert a date of format: dd/mm/yyyy to yyyymmdd format? For example from : 25/07/2011 to 20110725? in VB.NET?
Public Function DateFormateYYYYMMDD(ByVal Dtp As DateTimePicker) As String
Try
Dim StrDate, StrYear, StrMonth, StrDay As String
StrDate = FormatDateTime(Dtp.Value, DateFormat.ShortDate)
StrMonth = Month(Dtp.Value)
StrDay = Convert.ToString(Dtp.Value.Day)
StrYear = Year(Dtp.Value)
StrDate = StrYear + "-" + StrMonth + "-" + StrDay
Return StrDate
Catch ex As Exception
End Try
End Function
this function can be used to convert datetime picker value format to yyyyMMdd