alwaysVBNET
alwaysVBNET

Reputation: 3310

Convert Greek date with Greek characters to English US

I am trying to convert a Greek date string to Date en-US. However, I'm getting a FormatException which I'm not sure how to handle:

    Dim input = "Τρίτη, 26, 2011" 'Greek characters
    Dim format = "dddd, dd, yyyy"
    Dim dt = DateTime.ParseExact(input, format, New CultureInfo("el-GR")) '<-- Error here
    Dim result = dt.ToString(format, New CultureInfo("es-US"))
    MsgBox(result)

Any ideas?

Upvotes: 2

Views: 317

Answers (1)

"Τρίτη, 26, 2011" translates as "Tuesday, 26, 2011" which is not enough data to create a DateTime variable from (there is no month).

You need something like "Τρίτη, 26 Ιουλίου 2011" (Tuesday, 26 July 2011) from wherever you get this from.

Upvotes: 2

Related Questions