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!

turning a number into a date 1

Status
Not open for further replies.

manny1234

IS-IT--Management
Mar 13, 2006
58
US
I have a field in my DB that stores date and time in a number string like so 20060522143600 yyyymmddhhmmss. How could I go about breaking this number up so it is a legible date in a datagrid?
 
ok, I pull a date from an as400 that is stored in century date format. so, what I do is, create another field in my DB and use a formula to place the date together in a format I want.

e.g.

(substring([Yourfield],4,2) + '/' + substring([Yourfield],6,2) + '/' + substring([Yourfield],2,2))

the numbers represent what char's you want to include in the string..

I do it this way so I don't have to mess with it on the front end.

 
Have a look into the CONVERT funtion in SQL Server


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
substring was what I needed. I cannot believe I forgot all about that. Thanks! It fixed a phone number formatting issue I was having too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top