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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refromat date from yyyymmdd to dd/mm/yyyy 1

Status
Not open for further replies.

coolicus

Programmer
May 15, 2007
50
GB
A database holds the date as a varchar in the format yyyymmdd so today is held as 20080320

Is it possible to output this on my page as 20/03/2008

At present I just call it using rs("deadlinedate") which outputs 20080320. I tried to use right and left

thanks for any help you can give
 
This has been addressed several times in this forum which should be reflected in a search. The quick answer, for now, should get you going is to use string manipulation. Something like the following:
Code:
dim myDate
myDate = right(rs("deadlinedate"),2) & "/" & mid(rs("deadlinedate"),5,2) & "/" & left(rs("deadlinedate"),4)
I would advise that you verify that structure as I'm going from a rather rusty memory on the syntax for those functions, but it should give you an idea of what you'll need.

------------------------------------------------------------------------------------------------------------------------
"As for the bureacratic, politically-correct, mollycoddling, asinine, Romper Room antics of...clients and management, just read up on Dilbert. It's not funny - it's a training manual."
- Mike
 
aha, I didn`t know there was a mid hehe. I used left and right but couldn`t get the month out on it's own!

thanks chopstik I have given you a star and have bookmarked this page for future reference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top