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 format like Jan 11 2002 PLEASE HELP 1

Status
Not open for further replies.

jennypretty

IS-IT--Management
Apr 13, 2005
45
US
Hello friends,
I am trying to format the date return and it generate this error: DateTimeFormat is not a recognized funtion name.

Select Cast(FormatDateTime(hiredate,2) as varchar(50)
from emp

The date format return I want is like this: Jan 11 2002.

I also tried this, Cast(FormatDateTime(hiredate,"mmm dd yyyy") as varchar(50)

Please help.
Thanks,
Jenny.
 
except be careful not to put the FROM clause in there twice... I'm not sure if it was on a subsequent line or not.
 
Now it worked, myshortdate.
I also tried to use the CONVERT function and it also worked.
Which one is better?
Do youo think the CONVERT function will make the slower workload on the server?

Thanks,
Jenny.
 
The convert function runs on the database. The other method runs on your web server.

Frankly the only reason that I suggested using the database is that this approach was used to solve your problem in the other thread... and there is something to be said for consistancy.

I personally prefer to only use the database for data and to do the display formatting with the web server script.

As you have seen, either way will work... use the technique that is easiest for you to understand and remember.
 
It is best to format data for display in the front-end (ASP). That way you can still use your data to perform any calculation based logic on the fron-end with-out a round-trip to the server.

~ Spicolli

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top