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

DATE time stamp

Status
Not open for further replies.

EPNICO

MIS
Jun 14, 2001
45
US
Hello Everyone: Is there a way in sql when you have a field that has date time stamp to extract the mmddyyyy and formatted into mm/dd/yyyy and forget about the time area?

Any ideas are welcome.


Thanks.
Rick

 
To display it in your desired format:
Code:
to_char(timestamp,'mm/dd/yyyy')
If you actually want to remove the time from the field:
Code:
to_char(trunc(timestamp),'mm/dd/yyyy')


Code:
select * from Life where Brain is not null
Consultant/Custom Forms & PL/SQL - Oracle 8.1.7 - Windows 2000
When posting code, please use TGML to help readability. Thanks!
 
Thanks for the info. But in my MS SQL 2000 query analyzer I don't find anything in ref. to_char? I'm extracting info for a HR database and creating a delimited output file. So this date field has to have this format mm/dd/yyyy.

Thanks.
Rick:
 
Always helpful to know what tool you are using. Sorry, my answer was for Oracle.

Code:
select * from Life where Brain is not null
Consultant/Custom Forms & PL/SQL - Oracle 8.1.7 - Windows 2000
When posting code, please use TGML to help readability. Thanks!
 
Thanks for the ideas it pointed me in the right direction the syntax is the following that worked for me on MS SQL 2000.

CONVERT(CHAR(10),EEICWDATAADJUSTED,101)

I get the proper date in mm/dd/yyyy.


Thanks guys.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top