Richard,
ODBC provides escape syntax to specify what how dates are returned from the
database:
e.g. Select * from Table where Date = {d '2000-11-17'}
Best regards,
Andrew
--------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com
> -----Original Message-----
> From: Richard Quadling [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 02, 2001 12:10 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Getting a date from MS SQL in the correct format.
>
>
> I want to extract a date from a datetime field in Microsoft SQL, via ODBC
> ('cause we support different databases, or so I'm told, and hey, what do I
> know!!!!! <grrrrr!>).
>
> I want the format to be CCYYMMDD.
>
> Is there a MS SQL function for this?
>
> I've found DATEPART("YYYY",field), but I don't know how to get
> all the bits
> (i.e. YYYY, MM, DD). I get a numerical addition.
>
> If I CAST as varchar, I don't get a 0 for <10 on MM and DD.
> i.e. 1st January 2001 comes out as 200111 rather than 20010101
>
> I know there must be a format function, but SQL novice here can't find it.
>
> Any suggestions. In the mean time, I've had to use DATEPART to pull the
> three bits in separately and add a bit to the PHP templates to
> add them all
> together. Ideally I want just the value as CCYYMMDD.
>
> Regards,
>
> Richard Quadling.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]