Professional Web Applications Themes

need help: Mysql Time format problem - MySQL

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....

  1. #1

    Default need help: Mysql Time format problem

    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.

    johnbao@gmail.com Guest

  2. #2

    Default Re: need help: Mysql Time format problem

    On 8 Feb, 16:19, com wrote: 

    I can't see any difference betwen the 2 commands???

    Captain Guest

  3. #3

    Default Re: need help: Mysql Time format problem

    On 8 Feb 2007 08:19:26 -0800, com wrote: 

    Perhaps I am confused. I do not see the difference between those
    commands, and neither produce 09:30. Both %H and %k are doented to do
    no modulo transformation, and the others are doented 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.
    Peter Guest

  4. #4

    Default Re: need help: Mysql Time format problem

    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" <com>
    wrote: 




    >
    > I can't see any difference betwen the 2 commands???- Hide quoted text -
    >
    > - Show quoted text -[/ref]


    johnbao@gmail.com Guest

  5. #5

    Default Re: need help: Mysql Time format problem

    On 8 Feb 2007 09:57:16 -0800, com wrote: 

    Working as doented:

    http://dev.mysql.com/doc/refman/5.0/en/date-and-time-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
    Peter Guest

Similar Threads

  1. Time::Format
    By Paul Kraus in forum PERL Beginners
    Replies: 1
    Last Post: January 26th, 08:43 PM
  2. Time format
    By YAC WP in forum PHP Development
    Replies: 15
    Last Post: October 23rd, 05:35 PM
  3. Time/Date format and changing time to GMT
    By Shaiboy_UK in forum ASP
    Replies: 1
    Last Post: October 19th, 01:04 PM
  4. Format time
    By Lasse Edsvik in forum ASP
    Replies: 1
    Last Post: October 13th, 02:55 PM
  5. ANNOUNCE: Time::Format v0.12
    By Eric J. Roode in forum PERL Modules
    Replies: 6
    Last Post: July 24th, 04:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139