473,657 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Truncated incorrect time value: '1:05 AM'

40 New Member
Hai All,

This is my create statement
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `dbname`.`tablename` (
  2. `vh_id` int(10) unsigned NOT NULL,
  3. `gh_utc` time NOT NULL,
  4. `gh_mydate` date default NULL,
  5. `gh_serverdate_time` timestamp NOT NULL default CURRENT_TIMESTAMP,
  6. KEY `FK_geo_gpsdata_2` (`vh_id`)
  7. ) 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.
Expand|Select|Wrap|Line Numbers
  1. SELECT time_format(gh_utc ,'%H:%m:%s'),
  2. date_format(gh_mydate,'%d/%m/%Y')
  3. FROM tablename where vh_id='1' and timestamp(gh_mydate,gh_utc)
  4. between timestamp('2009/01/01','1:05 AM') and timestamp('2009/01/16','1:05 PM') ;
Awaiting for the reply.

Thanks in advance
Jan 12 '09 #1
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.
Jan 12 '09 #2
crs27
40 New Member
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.
Jan 12 '09 #3
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.
Jan 12 '09 #4
crs27
40 New Member
thanks again atli.Shal follow the same.
Jan 12 '09 #5

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

Similar topics

4
2399
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
8
8202
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?
5
2930
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
0
1386
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...
4
2234
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
12
2216
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
8
2098
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
13
32687
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:
1
5579
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...
0
8324
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,...
0
8842
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, 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...
0
8740
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 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...
0
7353
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, 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...
1
6176
isladogs
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...
0
4173
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...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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
2
1733
bsmnconsultancy
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...

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.