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

Date formatting

Status
Not open for further replies.

sborny

Technical User
Jun 29, 2001
157
GB
Hi,

I have an app that pulls data from a database which I can do no problem.

One of the fields contains a date in plain format

ie 250772 (25th July 1972)

Please note that these are english format for dates.

I need my app to pull this data and conver it to the following format.

25-JUL-1972

I have looked at the date function and the format function but cannot seem to get it to work.

Any ideas.

Cheers

S.


Everything has an answer, it's just knowing the right question to ask. !!!!
 
dd & "-" & mmm & "-" & yyyy

not sure though, youre best waiting for some1 else to reply

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
There are many approaches to this. The simple way might be:
Convert number to string, using Cstr()
Add / as date separators, using Left$(), Mid$() and Right$() first to split into 3, recombining with '&'
Convert to proper date using Format using "dd-mmm-yy" format string

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Simpler:

Format$(Format$("250772","##-##-##"),"dd-mmm-yyyy")

Assuming the date string is always 6 digits, and the system is set in the same format (dd-mm-yyyy, meaning day/month, and not month/day)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top