473,508 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MSSQL not showing seconds even after using datetime as the column type

10 New Member
In MSSQL I am using datetime as the column type and trying to execute the below mentioned query

select time from tickets where ticket_id = '1';

when i execute the query on sql manager window it shows it correctly with seconds and milliseconds in the output like this

2008-01-30 13:58:04.000

But when i run the sql through PHP it replaces the seconds and milliseconds with AM/PM
sql1="select time from tickets where ticket_id = '1' ";
$row1=mssql_query($sql1);
$res1=mssql_fetch_assoc($row1);

output comes like this

Array ( [time] => Jan 30 2008 1:52PM )

Please help on how to get the full datetime including seconds and milliseconds and not with AM/PM using PHP

Thanks
Jan 30 '08 #1
4 2967
ck9663
2,878 Recognized Expert Specialist
In MSSQL I am using datetime as the column type and trying to execute the below mentioned query

select time from tickets where ticket_id = '1';

when i execute the query on sql manager window it shows it correctly with seconds and milliseconds in the output like this

2008-01-30 13:58:04.000

But when i run the sql through PHP it replaces the seconds and milliseconds with AM/PM
sql1="select time from tickets where ticket_id = '1' ";
$row1=mssql_query($sql1);
$res1=mssql_fetch_assoc($row1);

output comes like this

Array ( [time] => Jan 30 2008 1:52PM )

Please help on how to get the full datetime including seconds and milliseconds and not with AM/PM using PHP

Thanks
if it's showing properly in SQL and not in PHP, that would you have to check how you access and/or display your field in PHP, not in SQL

-- ck
Jan 30 '08 #2
pks83
10 New Member
if it's showing properly in SQL and not in PHP, that would you have to check how you access and/or display your field in PHP, not in SQL

-- ck
But i am jus giving a print_r command to display the array value not fetching it in any field.
Jan 30 '08 #3
ck9663
2,878 Recognized Expert Specialist
But i am jus giving a print_r command to display the array value not fetching it in any field.
sorry but that would be a PHP issue, not SQL-Server. have you tried asking the experts in PHP forum?

-- ck
Jan 30 '08 #4
pks83
10 New Member
sorry but that would be a PHP issue, not SQL-Server. have you tried asking the experts in PHP forum?

-- ck
Thanks for the inputs ck i will post the question over there also now
Jan 30 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
4669
by: Bostonasian | last post by:
I have a table that contains transactional data. Such as site view by whom, when, which template, etc, etc... Everytime when I pulled the report, hh:mm:ss never matters. Only breakdown by dates,...
14
2446
by: Kukurydz | last post by:
I've got such problem: My database is stored on MSSQL Server. I have to write reports for it in MSAccess. I've got a problem with creating a query which will select records from MSSQL table with...
1
2427
by: thomas kern | last post by:
hi, i tried to insert a record into a mssql-table. one column is DateTime. i tried this one: insert into fixtures (dategame) VALUES ('24.01.2003') unfortunately i receive an error -- error...
1
3514
by: Kenneth P | last post by:
Hi, I'm trying to do some Custom Paging technique with the datagrid object and with the select command in Sql, thus forcing the server to only select those rows from the database that should be...
2
1938
by: TerryW | last post by:
I am using a system.windows.forms.datagrid and i set it's data source to a system.data.datatable which has a column that's dataType is system.dateTime. When I try to enter minutes and seconds...
11
31724
by: ralphie | last post by:
hi all since nearly 2 days i fight with mssql and utf-8 as i need to store and retrieve arabic characters. i tried the com approach ...
2
9281
by: jblankenburg | last post by:
Please help! I am hunting high and low for an equivalent function for MSSQL's DATENAME function. Here's the spec on the function from MSSQL's Books Online: DATENAME Returns a character...
2
2358
by: pks83 | last post by:
In MSSQL I am using datetime as the column type and trying to execute the below mentioned query select time from tickets where ticket_id = '1'; when i execute the query on sql manager window it...
4
3128
by: chromis | last post by:
Hi, I know this question has been asked before, but I seem to be getting different results from everyone else. I want to return times from my db table in this format: hh:mm:ss.mmm using mssql....
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.