Hey, I am trying to convert an elbonian date which has a format day-year-month to a US date month-day-year in Long date format, any suggestion on how i can achieve this.

Here's what it is suppose to look like:

[IMG]http://img201.imageshack.us/img201/7435/testwf.jpg[/IMG]

Uploaded with ImageShack.us

Recommended Answers

All 2 Replies

Assumming the input for the elbonian date is a textbox1 you can:
a) split the input into 3 parts by "-" as separator
b) Verify that the year has 4 digits including century. this is needed for the next steep
c) Create an string in format of yyyy-MM-dd ( called also universal format), convet it to date-time and convert the result to long date string
d) Put the resulting date in your output control assuming label1
IE:

Dim dateParts as string() = textbox1.Text.Split("-"c)
If dateParts(1).Length = 2 Then dateParts(1) = "20" & dateParts(1)
Dim resultingDate as String = Ctype(dateParts(1) & "-" & dasteParts(2) & "-" & dateParts(0), DateTime).ToLongDateString
label1.Text = resultingDate

Hope this helps

You could use formatting options for converting dates and time..

Dim RightNow as Date = Now
Dim result as New System.Text.StringBuilder

'Elbonian
txtBoxElbonianDate.text = result.append("dd/yy/MM")

'Other
txtBoxAmerican.text = result.append("yy/MM/dd")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.