A astf Member Licensed User Longtime User Jun 26, 2012 #1 Please, I have a date in format dd/MM/yyyy adn i need yyyy-MM-dd DateTime.DateFormat = "dd/MM/yyyy" Dim data As Long data = DateTime.DateParse(txtData.Text) ' 26/06/2012 DateTime.DateFormat = "yyyy-MM-dd" data = DateTime.date(data) Click to expand... and i get this error LastException java.lang.NumberFormatException: Invali Double: "2012-06-26" :sign0085::sign0085::sign0085:
Please, I have a date in format dd/MM/yyyy adn i need yyyy-MM-dd DateTime.DateFormat = "dd/MM/yyyy" Dim data As Long data = DateTime.DateParse(txtData.Text) ' 26/06/2012 DateTime.DateFormat = "yyyy-MM-dd" data = DateTime.date(data) Click to expand... and i get this error LastException java.lang.NumberFormatException: Invali Double: "2012-06-26" :sign0085::sign0085::sign0085:
thedesolatesoul Expert Licensed User Longtime User Jun 26, 2012 #2 Becase you declared data as Long and now you are trying to put a string into it. You should declare another String variable to hold the date. Code: DateTime.DateFormat = "dd/MM/yyyy" Dim data As Long data = DateTime.DateParse(txtData.Text) ' 26/06/2012 DateTime.DateFormat = "yyyy-MM-dd" Dim DateString as String DateString = DateTime.date(data) Upvote 0
Becase you declared data as Long and now you are trying to put a string into it. You should declare another String variable to hold the date. Code: DateTime.DateFormat = "dd/MM/yyyy" Dim data As Long data = DateTime.DateParse(txtData.Text) ' 26/06/2012 DateTime.DateFormat = "yyyy-MM-dd" Dim DateString as String DateString = DateTime.date(data)