Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing order of a string! 1

Status
Not open for further replies.

hpadwal

Programmer
Feb 6, 2006
57
GB
Hello all,

I have 3200 entries of user Date of birth (DOB) entries in MM/DD/YYYY as a varcvhar.

i need to change these strings into DD/MM/YYYY, basically swap the numbers in the string around.

Is this possible?

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

- Doh

 
Code:
oldStr '03/24/2006'

newStr = mid(oldStr,4,2) & "/" & left(oldStr,2) & "/" & right(oldStr,4)

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
you mean at the database level or at the asp page level...

use CONVERT() or CAST() functions at the database level

and for the asp page level...do this

Dim myarray, mynewdate
myarray=split(mydate,'/')

mynewdate=myarray(1)&"/"&myarray(0)&"/"myarray(2)

-DNG
 
oops...missed one &

mynewdate=myarray(1) & "/" & myarray(0) & "/" & myarray(2)


-DNG
 
Amazing, really handy script :)

oldStr '03/24/2006'

newStr = mid(oldStr,4,2) & "/" & left(oldStr,2) & "/" & right(oldStr,4)

:)


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

- Doh

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top