John,

I had to go through the same dilemma once and here is the piece
of code that I hope will be useful .

This gets the date in the format you wish in the select statement
itself so you don't have to do any processing in the program regarding
retrieving the date field.

"select datename(dd, date_field) + '/' + datename(mm, date_field) + '/' +
datename(yy, date_field)
from tablename."

This will give you the date in the format:
'23/Dec/99'.


Regards,
Surabhi.

Surabhi Singh
Associate Developer            E: [EMAIL PROTECTED]
Hyperlink Plc                      T: +44 171 240 8121
8 Upper St Martin's Lane      F: +44 171 240 8098
London WC2H 9DL               W: http://hyperlink.com


-----Original Message-----
From:   John McDonald [SMTP:[EMAIL PROTECTED]]
Sent:   23 December 1999 16:12
To:     [EMAIL PROTECTED]
Subject:        Date formatting for MSSQL

Would anyone be kind enough to point me in the right direction for a peice
if code that will format dates, retrieved from an MSSQL database, into
something readable. The problem here is that MSSQL only stores dates in
(yy/mm/dd hh:mm:ss) format. I need to format that into mm/dd/yy and I
search by this formatted date. I am in the midst of a project where I must
use the MSSQL datetime type.

Anyone have any suggestions.

John D. McDonald
CipherStream Systems
Phone: 925.373.8700
Fax:     413.793.6603
email: [EMAIL PROTECTED]
web: www.cipherstream.com
-------------------------------------------------------
Secure E-Business Is Our Business
-------------------------------------------------------
 << File: ATT00029.htm >>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to