SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,156
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Post what is the datatype should be on this

    HI, Can i ask some help i am confuse...i want to store this time
    14:53:49 PM
    ,is it okay to use varchar datatype on this ?.or what datatype should i use on this ?


    Thank you in advance.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by jemz View Post
    i want to store this time
    http://dev.mysql.com/doc/refman/5.6/...ime-types.html

  3. #3
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,156
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi guido2004,

    i want to insert this 14:53:49 PM but i don't know what datatype for my column field.

    Thank you in avdvance.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,338
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by jemz View Post
    i want to insert this 14:53:49 PM
    first of all, that doesn't make sense

    it's either 14:53:49, without the PM, or else it's 2:53:49 PM -- but 14:something along with PM doesn't make sense

    and the datatype you're looking for is TIME

    it won't "store" the PM part, so if you want to see AM/PM when you retrieve the value, you need to use the DATE_FORMAT function
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,156
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    first of all, that doesn't make sense

    it's either 14:53:49, without the PM, or else it's 2:53:49 PM -- but 14:something along with PM doesn't make sense

    and the datatype you're looking for is TIME

    it won't "store" the PM part, so if you want to see AM/PM when you retrieve the value, you need to use the DATE_FORMAT function

    Thank you so much r937


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
  •