vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| how can I show time 45:30 as 21:30 in Mysql? commnd SELECT TIME_FORMAT( '45:30:00', '%H:%i' ) shows 45:30 and commnd SELECT TIME_FORMAT( '45:30:00', '%H:%i' ) shows 09:30 both are not 21:30 How do I do? thank you for the help. |
| |||
| On 8 Feb, 16:19, john...@gmail.com wrote: > how can I show time 45:30 as 21:30 in Mysql? > commnd > SELECT TIME_FORMAT( '45:30:00', '%H:%i' ) > shows > 45:30 > > and commnd > SELECT TIME_FORMAT( '45:30:00', '%H:%i' ) > shows > 09:30 > > both are not 21:30 > > How do I do? > > thank you for the help. I can't see any difference betwen the 2 commands??? |
| |||
| On 8 Feb 2007 08:19:26 -0800, johnbao@gmail.com wrote: > how can I show time 45:30 as 21:30 in Mysql? > commnd > SELECT TIME_FORMAT( '45:30:00', '%H:%i' ) > shows > 45:30 > > and commnd > SELECT TIME_FORMAT( '45:30:00', '%H:%i' ) > shows > 09:30 > > both are not 21:30 > > How do I do? > > thank you for the help. Perhaps I am confused. I do not see the difference between those commands, and neither produce 09:30. Both %H and %k are documented to do no modulo transformation, and the others are documented to modulo 12 hours, which is the 09:30 result you're getting with the mysterious unmentioned option. Since the functions don't do what you want them to, you'll have to roll your own. SELECT CONCAT(HOUR( '45:30:00' ) % 24, ':', MINUTE( '45:30:00' ) )'; -- Liberty, equality, diversity. Pick any two. |
| |||
| Sorry, the second command should be SELECT TIME_FORMAT( '45:30:00', '%h:%i' ) shows 09:30 any idea? On Feb 9, 12:32 am, "Captain Paralytic" <paul_laut...@yahoo.com> wrote: > On 8 Feb, 16:19, john...@gmail.com wrote: > > > > > > > how can I show time 45:30 as 21:30 in Mysql? > > commnd > > SELECT TIME_FORMAT( '45:30:00', '%H:%i' ) > > shows > > 45:30 > > > and commnd > > SELECT TIME_FORMAT( '45:30:00', '%H:%i' ) > > shows > > 09:30 > > > both are not 21:30 > > > How do I do? > > > thank you for the help. > > I can't see any difference betwen the 2 commands???- Hide quoted text - > > - Show quoted text - |
| ||||
| On 8 Feb 2007 09:57:16 -0800, johnbao@gmail.com wrote: > Sorry, the second command should be > > SELECT TIME_FORMAT( '45:30:00', '%h:%i' ) > shows > 09:30 > > > > any idea? Working as documented: http://dev.mysql.com/doc/refman/5.0/...functions.html If the /time/ value contains an hour part that is greater than 23, the %H and %k hour format specifiers produce a value larger than the usual range of 0..23. The other hour format specifiers produce the hour value modulo 12. -- 10. I will not interrogate my enemies in the inner sanctum -- a small hotel well outside my borders will work just as well. --Peter Anspach's list of things to do as an Evil Overlord |