0

The date that scan from word document which is 30/08/2012 but when it loads into my program it prints 20/10/05. Below code have error for convert it.

Dim str() As String

str(1) = Convert.ToDateTime(Format("yy-MM-dd")) Any suggestion?

1 Answer 1

1

Try this code

Dim output As Date = Date.ParseExact(str(1), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture)
Sign up to request clarification or add additional context in comments.

3 Comments

Error String was not recognized as a valid DateTime.
If str(1) value is 30/08/2012 is must recognize it. The first parameter must be the date string. Maybe it has more invalid characters: you have to get only the date string first.
i make a breakpoint.the str value is 30/08/2012.but i dunno why it execute become 20/10/05.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.