MarcC Posted November 16, 2012 Share Posted November 16, 2012 I needed to set a single article's created date, so I used this code from one of Ryan's forum posts: $page = $pages->get("/news/blah/"); $time = strtotime("2012-11-15"); // or whatever date you want wire('db')->query("UPDATE pages SET created=$time WHERE id={$page->id}"); The result was a date of 0000-00-00. I went in and changed it via PHPMyAdmin. Any ideas why that would happen? Link to comment Share on other sites More sharing options...
teppo Posted November 16, 2012 Share Posted November 16, 2012 I'm not sure why you're converting that date to Unix timestamp, but that's probably why this is failing. Try something along these lines instead: wire('db')->query("UPDATE pages SET created='2012-11-15' WHERE id={$page->id}"); The type of db field created is timestamp, which doesn't by default accept Unix timestamps (...) as it's value. 2 Link to comment Share on other sites More sharing options...
ryan Posted November 17, 2012 Share Posted November 17, 2012 Sorry Marc, I'm guessing I wrote the wrong thing in some other thread. If you know what post that was, let me know and I'll correct it. Teppo's code is correct. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now