how to assign a string to a date

how to assign a string to a date ?

vStringa = “30/11/2013”

MiaData = ?

Using “ParseDate”.

Type “ParseDate” in the “search” field of the language reference.

From the top of my head, you can also do :

[code]Dim datNow As New Date
Dim strDate as String = “30-11-2013”
Dim strMiaDate As String

datNow.day = Val(NthField(strDate, “-”, 1))
datNow.Month = Val(NthField(strDate, “-”, 2))
datNow.Year = Val(NthField(strDate, “-”, 3))

strMiaDate = "Miadate = " + datNow.LongDate
MsgBox strMiaDate[/code]

Remember I did not try out this code, but it shows you the principle.

Wish you a nice day.

Chris

The right solution is:

vStringa = “10/11/2013”
Dim miaData As New Date
Dim checkDate As Boolean
checkDate = ParseDate(vStringa, miaData)

Now ‘miaData’ contains the string value

Better:

vStringa = "10/11/2013"
Dim miaData As New Date
if not ParseDate(vStringa, miaData) then miaData = Nil