Hai All,
This is my create statement -
CREATE TABLE `dbname`.`tablename` (
-
`vh_id` int(10) unsigned NOT NULL,
-
`gh_utc` time NOT NULL,
-
`gh_mydate` date default NULL,
-
`gh_serverdate_time` timestamp NOT NULL default CURRENT_TIMESTAMP,
-
KEY `FK_geo_gpsdata_2` (`vh_id`)
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
when i query this table im getting "Truncated incorrect time value: '1:05 AM"
the below is the query.Not getting why the time value is truncated. -
SELECT time_format(gh_utc ,'%H:%m:%s'),
-
date_format(gh_mydate,'%d/%m/%Y')
-
FROM tablename where vh_id='1' and timestamp(gh_mydate,gh_utc)
-
between timestamp('2009/01/01','1:05 AM') and timestamp('2009/01/16','1:05 PM') ;
Awaiting for the reply.
Thanks in advance
4 14982 Atli 5,058
Recognized Expert Expert
Hi.
The string "1:05 PM" is an invalid time value. MySQL uses a 24 hour "HH:MM:SS" syntax.
As a result, MySQL *truncates* the value you gave it and turns it into the most likely alternative that fits the required syntax, which becomes "01:05:00".
To get the effect you are after, you need to use "13:05" for the PM value and "01:05" for the AM value.
thanks for the reply Atli.
I realized that,but i did not want to add 12 in my logic and then to make it 24 hr time.
Is their any other way that i get 24hr time in the query itself.
Atli 5,058
Recognized Expert Expert
You could use the STR_TO_DATE function to convert it into a valid value.
Although, I would advise you to have your front-end do this conversion instead. It's a lot cleaner that way.
thanks again atli.Shal follow the same.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: theintrepidfox |
last post by:
Dear Group
Some but not all of the dates are incorrect converted (incremented by 1
day) with the following SQL statement.
SELECT DISTINCT CONVERT(datetime,cast(ReturnedByDate AS int)) AS
ReturnedByDate, CONVERT(varchar(10),ReturnedByDate,104) AS
LabelReturnedByDate, ReturnedByDate FROM i2b_keytransactionhistory
ORDER BY ReturnedByDate ASC
|
by: skinnybloke |
last post by:
Hi - I have a problem with a memo field being truncated to about 255
characters when running a Access 2002 query.
This only seems to happen if I use SELECT DISTINCT. It works ok using
SELECT by itself.
does anyone know why this happens and how to stop it?
|
by: m_t_hill |
last post by:
Running MS Access 2000
MS Windows XP Pro
This has caused me a lot of hair loss in the last few days so would
appreciate any help.
I am running code to append/update a local access database from a
remote MS SQL database. The method of determining which records to
append is primarily using the last date an update was carried out; I
appreciate that there is probably a better way of doing this but time
|
by: Ed Bick |
last post by:
Well, I read today about how I could set the dropdown value to False to
change the control from presenting a Calendar to cycling through the times.
Before getting that, I developed a custom Time Combo control, which I think
I still prefer, so I'll share it here.
It has two main features. One, an Increment Property, which allows you to
set whether you see every minute of the day, every five minutes, ten,
fifteen, twenty, thirty, or just...
|
by: Jack |
last post by:
THE FOLLOWING IS A PART OF CODE FROM A ASP PAGE
<%
sql01 = "SELECT COUNT(*) AS reccount FROM Equipmenttbl "
sql01 = sql01 & "WHERE Equipmenttbl.GrantID = " & GrantID
'Response.Write sql01 & "<br>"
'Response.End
i = 0
| |
by: Jack |
last post by:
Since,
I have not got some desired advise, I am reposting this for some
asnwer/valuable suggestion. Thanks.
THE FOLLOWING IS A PART OF CODE FROM A ASP PAGE
<%
sql01 = "SELECT COUNT(*) AS reccount FROM Equipmenttbl "
sql01 = sql01 & "WHERE Equipmenttbl.GrantID = " & GrantID
|
by: Derek |
last post by:
Hi
Hope that this is the correct newsgroup for this, sorry if it is not.
I have the following code which is used to display the data brought back
from a MySQL database in an input box so that a user cam make changes before
resubmitting them.
If I display $myrow all of the text is there, if I use the following code
only the first word is show The same happens if I simply use $myrow and
|
by: chromis |
last post by:
Hi,
I have a query which updates the projects table of my database, however when I try to run my query with blank values i get the following error:
Data truncation: Data truncated for column 'date' at row 1
I have done some researching and I believe the problem is to do with the data that is being sent by my cfqueryparam function.
Here is my create function:
|
by: sanjupommen |
last post by:
I am in the process of exploring the possibility of providing our products on databases other than Oracle.I am able to migrate the data, procedures etc without too much effort (latest version of DB2 seems to have improved a lot compared to the earlier ones).*
Unfortunately, I have limited knowledge of DB2, especially in setting the server parameters, their impact on an environment with high concurrency etc. As a result, we are getting very high...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |