Connecting Tech Pros Worldwide Forums | Help | Site Map

php and mssql 's date type

Obscurr
Guest
 
Posts: n/a
#1: Jul 17 '05
hi,

I fetch a row from an MSSQL db with a field that's of type date. I'm returned
i.e. Oct 15 2003 12:00AM.
code:
$test = mssql_fetch_row($resultmail);
echo $test[0];

I want only to get the date returned and not the time i.e. Oct 15 2003.
Any clever way of doing that?

obscurr

Tom Thackrey
Guest
 
Posts: n/a
#2: Jul 17 '05

re: php and mssql 's date type



On 23-Oct-2003, obscurr@hotmail.com (Obscurr) wrote:
[color=blue]
> I fetch a row from an MSSQL db with a field that's of type date. I'm
> returned
> i.e. Oct 15 2003 12:00AM.
> code:
> $test = mssql_fetch_row($resultmail);
> echo $test[0];
>
> I want only to get the date returned and not the time i.e. Oct 15 2003.
> Any clever way of doing that?[/color]

select date_format(datecolumnname,'%b %d %Y') from ...

see
http://www.mysql.com/doc/en/Date_and...functions.html

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)
Jochen Daum
Guest
 
Posts: n/a
#3: Jul 17 '05

re: php and mssql 's date type


Hi !

On 23 Oct 2003 06:01:04 -0700, obscurr@hotmail.com (Obscurr) wrote:
[color=blue]
>hi,
>
>I fetch a row from an MSSQL db with a field that's of type date. I'm returned
>i.e. Oct 15 2003 12:00AM.
>code:
>$test = mssql_fetch_row($resultmail);
>echo $test[0];
>
>I want only to get the date returned and not the time i.e. Oct 15 2003.
>Any clever way of doing that?
>[/color]

select convert (datetime, column, 106) from table

or look at convert in the MSSQL help file.

HTH, Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Closed Thread