SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member Novak's Avatar
    Join Date
    Aug 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Nuby Pre 1970 Date Problem

    I'm new to ruby/rails, not programming but I'm having a problem getting my RoR application to insert pre 1970 datetime's into the database (MySQL).

    I've seen a few ugly fixes around but im sure its something simple im doing wrong atm. Has anyone else had this problem?

  2. #2
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe you can fix it by using DateTimes instead of Times?

  3. #3
    SitePoint Evangelist ikeo's Avatar
    Join Date
    Oct 2004
    Location
    Austin Texas
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the type of the column in the table where the data is being stored?
    Sounds like you're using a unix time stamp instead of saving the date in Mysql Datetime format.

  4. #4
    SitePoint Member Novak's Avatar
    Join Date
    Aug 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Everything is being handled by ActiveRecord etc.

    *this is the table
    CREATE TABLE albums (
    id int(11) NOT NULL auto_increment,
    title varchar(255) NOT NULL default '',
    artist varchar(255) NOT NULL default '',
    release_date datetime NOT NULL default '0000-00-00 00:00:00',
    genre varchar(50) NOT NULL default '',
    PRIMARY KEY (id)
    );

    now if just scaffold it and go to edit or new and create an album with a release date after 1970 it works... but it you set it before RoR chokes.


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
  •