how to convert date format to "DD/MM/YYYY"

liunx

Guest
Hi
I am using ASP.NET with VB.NET to develope a web application, my applications passes date values in a Query String form one page (A) to Page (B) in the format "DD/MM/YYYY", in the page (B) i have to make calculations on the date (adding, and subtruction) so i have to convert the string to date, but my application thowing an exception if the date like "13/01/2005", but does not if the date like "12/01/2005" (i.e: it is dealing with the format "MM/DD/YYYY" only), how i can instruct my application to deal with another format -( the date format have to be dynamic - i will store the formats in the data base and the user will choose the format-)

Thanks'Your querystring
Dim DT As String = "13/01/2005"

'Parts array of your querystring {13,01,2005}
Dim DTparts() As String = DT.Split("/")

'Rebuild it "01/13/2005"
DT = DTparts(1) & "/" & DTparts(0) & "/" & DTparts(2)


Good luck!
 
Back
Top