SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Minutes & seconds only

    I only want to store minutes & seconds for DVD chapter times, i.e., 3:10, or :24.

    Should I use TIME, or is there a better way?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It's not really a TIME in the sense of a date and time data type, but a single numeric value formatted as a time. Make it an integer column and store the number of seconds (190, 24), and format it in whatever scale you want on the way out.

  3. #3
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure how to create that column. Or would that be two columns? What would the INSERT query look like?

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Code:
    CREATE TABLE dvd_chapters (dvd_id INT, chapter_id INT, chapter_name VARCHAR(255), chapter_length INT);
    
    INSERT INTO dvd_chapters (1, 1, 'Previews', 190);
    INSERT INTO dvd_chapters (1, 2, 'Copyright Notice', 24);

  5. #5
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see what you're doing. I was confused because I was still thinking 3:10 instead of 190. Makes perfect sense to me now.

    Thanks!


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
  •