
March 25th, 2008, 11:35 AM
| | | DATE Format
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 | 
March 25th, 2008, 12:15 PM
| | | Re: DATE Format
yashiro wrote: Quote:
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
================== | 
March 25th, 2008, 01:55 PM
| | | Re: DATE Format
On 25 Mar, 10:28, yashiro <noum...@yahoo.frwrote: Quote:
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. | 
March 25th, 2008, 02:25 PM
| | | Re: DATE Format
Captain Paralytic wrote: Quote:
On 25 Mar, 10:28, yashiro <noum...@yahoo.frwrote: Quote:
>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. | 
March 25th, 2008, 03:25 PM
| | | Re: DATE Format
----- Original Message -----
From: "yashiro" <noumian@yahoo.fr>
Newsgroups: comp.lang.php
Sent: Tuesday, March 25, 2008 11:28 AM
Subject: DATE Format Quote:
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
| Hi,
I think you should change the date format in SQL server.
It is possible it depends on your locale.
Best to ask in a MS SQL server newsgroup or forum..
Good luck,
Richard | 
March 25th, 2008, 03:45 PM
| | | Re: DATE Format
thank you guys
i solve the problem myself
i just have to change de format like this
SELECT CONVERT(VARCHAR, incident.date_, 120) FROM table1
then i am able to show the data as i want using date
date("d.m.y", strtotime($row[0]))
thanks | 
March 25th, 2008, 05:15 PM
| | | Re: DATE Format
Captain Paralytic wrote: Quote:
On 25 Mar, 10:28, yashiro <noum...@yahoo.frwrote: Quote:
>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.
>
| Except this is SQL Server, not MySQL.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== | 
March 25th, 2008, 07:35 PM
| | | Re: DATE Format
..oO(yashiro) Quote:
>thank you guys
>i solve the problem myself
>i just have to change de format like this
>
>SELECT CONVERT(VARCHAR, incident.date_, 120) FROM table1
>
>then i am able to show the data as i want using date
>date("d.m.y", strtotime($row[0]))
| Looks just like an ugly hack. Doesn't your SQL server have its own date
formatting functions?
Micha | 
March 25th, 2008, 08:45 PM
| | | Re: DATE Format
"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
news:Se-dnWd8bfxrQXXanZ2dnUVZ_v_inZ2d@comcast.com... Quote:
yashiro wrote: Quote:
>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. |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|