Click here to get back home

DATE Format

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
DATE Format yashiro 03-25-2008
---> Re: DATE Format Jerry Stuckle03-25-2008
---> Re: DATE Format Captain Paralyt...03-25-2008
| |--> Re: DATE Format The Natural Phi...03-25-2008
| `--> Re: DATE Format Jerry Stuckle03-25-2008
Posted by yashiro on March 25, 2008, 6:28 am
Please log in for more thread options
Hello
i Have a database in SQLserver.
I am using php to connect to it and to retrieve data from that
database.
I have a table with a column (DATATIME)

where i do :
$result = mssql_query("SELECT date FROM table1") or
die(mssql_error());

while ($row=mssql_fetch_array($result,MSSQL_NUM)){
echo $row[1];
}

i got the data like :

17/mars/2008 10:54
18/mars/2008 15:34

why the default date format is : DD/MON/YYYY HH:ii:ss
where can i change de that default format?
or how can i change that format?

i have tried :
echo ;date("d.m.y HH:i", strtotime($row[1]))

it showed me 01.01.70

thanks

Posted by Jerry Stuckle on March 25, 2008, 8:07 am
Please log in for more thread options
yashiro wrote:
> Hello
> i Have a database in SQLserver.
> I am using php to connect to it and to retrieve data from that
> database.
> I have a table with a column (DATATIME)
>
> where i do :
> $result = mssql_query("SELECT date FROM table1") or
> die(mssql_error());
>
> while ($row=mssql_fetch_array($result,MSSQL_NUM)){
> echo $row[1];
> }
>
> i got the data like :
>
> 17/mars/2008 10:54
> 18/mars/2008 15:34
>
> why the default date format is : DD/MON/YYYY HH:ii:ss
> where can i change de that default format?
> or how can i change that format?
>
> i have tried :
> echo ;date("d.m.y HH:i", strtotime($row[1]))
>
> it showed me 01.01.70
>
> thanks
>

This is the format MySQL is returning data. I suggest you try a MySQL
newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================


Posted by Richard on March 25, 2008, 3:38 pm
Please log in for more thread options

> yashiro wrote:
>> Hello
>> i Have a database in SQLserver.
>> I am using php to connect to it and to retrieve data from that
>> database.
>> I have a table with a column (DATATIME)
>>
>> where i do :
>> $result = mssql_query("SELECT date FROM table1") or
>> die(mssql_error());
>>
>> while ($row=mssql_fetch_array($result,MSSQL_NUM)){
>> echo $row[1];
>> }
>>
>> i got the data like :
>>
>> 17/mars/2008 10:54
>> 18/mars/2008 15:34
>>
>> why the default date format is : DD/MON/YYYY HH:ii:ss
>> where can i change de that default format?
>> or how can i change that format?
>>
>> i have tried :
>> echo ;date("d.m.y HH:i", strtotime($row[1]))
>>
>> it showed me 01.01.70
>>
>> thanks
>>
>
> This is the format MySQL is returning data. I suggest you try a
> MySQL newsgroup.
>


Except this is SQL Server, not MySQL.


R.



Posted by Captain Paralytic on March 25, 2008, 8:48 am
Please log in for more thread options
> Hello
> i Have a database in SQLserver.
> I am using php to connect to it and to retrieve data from that
> database.
> I have a table with a column (DATATIME)
>
> where i do :
> $result = mssql_query("SELECT date FROM table1") or
> die(mssql_error());
>
> while ($row=mssql_fetch_array($result,MSSQL_NUM)){
> echo $row[1];
>
> }
>
> i got the data like :
>
> 17/mars/2008 10:54
> 18/mars/2008 15:34
>
> why the default date format is : DD/MON/YYYY HH:ii:ss
> where can i change de that default format?
> or how can i change that format?
>
> i have tried :
> echo ;date("d.m.y HH:i", strtotime($row[1]))
>
> it showed me 01.01.70
>
> thanks

I doubt if the column is DATATIME, it is more likely DATETIME.
Could you export the table schema and post it?
According to the manual for MySQL 5.0, the system variables to change
the default datetime output format is not yet implemented so I'm very
surprised to see an output like this from a DATETIME field.
You should use the MySQL function DATE_FORMAT() to output the field
value as you want it.

Posted by The Natural Philosopher on March 25, 2008, 9:23 am
Please log in for more thread options
Captain Paralytic wrote:
>> Hello
>> i Have a database in SQLserver.
>> I am using php to connect to it and to retrieve data from that
>> database.
>> I have a table with a column (DATATIME)
>>
>> where i do :
>> $result = mssql_query("SELECT date FROM table1") or
>> die(mssql_error());
>>
>> while ($row=mssql_fetch_array($result,MSSQL_NUM)){
>> echo $row[1];
>>
>> }
>>
>> i got the data like :
>>
>> 17/mars/2008 10:54
>> 18/mars/2008 15:34
>>
>> why the default date format is : DD/MON/YYYY HH:ii:ss
>> where can i change de that default format?
>> or how can i change that format?
>>
>> i have tried :
>> echo ;date("d.m.y HH:i", strtotime($row[1]))
>>
>> it showed me 01.01.70
>>
>> thanks
>
> I doubt if the column is DATATIME, it is more likely DATETIME.
> Could you export the table schema and post it?
> According to the manual for MySQL 5.0, the system variables to change
> the default datetime output format is not yet implemented so I'm very
> surprised to see an output like this from a DATETIME field.
> You should use the MySQL function DATE_FORMAT() to output the field
> value as you want it.

That's what I do.

Similar ThreadsPosted
Date format March 12, 2005, 6:48 pm
How to format a date? January 14, 2008, 6:28 pm
Convert a date format May 25, 2006, 4:30 pm
SQL Statement with DATE format June 25, 2007, 6:39 am
Date storage format January 1, 2008, 9:22 am
rss date (rfc822) format September 20, 2008, 11:08 pm
Always local Time & date format? November 12, 2004, 11:55 am
Input string and date format December 3, 2004, 5:08 pm
Date stored in DB in the following format: 2004-06-29 09:06:36+01 July 8, 2005, 2:53 am
How to format at date field output July 25, 2006, 8:49 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap