php and mssql 's date type

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Obscurr

    php and mssql 's date type

    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

    #2
    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(dat ecolumnname,'%b %d %Y') from ...

    see


    --
    Tom Thackrey

    tom (at) creative (dash) light (dot) com
    do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

    Comment

    • Jochen Daum

      #3
      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.
      Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

      Comment

      Working...