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

Numberic to Date function 1

Status
Not open for further replies.

JBaileys

Technical User
Jun 23, 2003
244
US

This seems extremely simple - but I am fumbling on a Monday morning... :(

I have fields transyear, transmonth and transday. They are all numeric. If I want to display a date field how would I go about it.

Select transyear +'/'+ transmonth +'/' + transday

 
Try this, it works for me in the UK.
[tt]
select convert(datetime, str(transyear) + '-' + str(transmonth) + '-' + str(transday))
[/tt]


Code:
|_ |_  _  | _  _
|, | )(/, |(_)| )
          '
 
select convert(datetime, '20040419', 112) -- using dat format YYYYMMDD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top