vanyok Posted December 12, 2006 Share Posted December 12, 2006 This should be simple .. I hope :)Trying to get current system to store it in the DB ( MySQL format). I'm using$date=date("Y-m-d");For some reason $date returns me 0000-00-00 Whyyyyyyyyyy ? Thank you. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 12, 2006 Share Posted December 12, 2006 If you use the time() function, what value does it give you? Link to comment Share on other sites More sharing options...
vanyok Posted December 12, 2006 Author Share Posted December 12, 2006 $time() returned 1165945816From reading varios things it seems like I need to create some kind of a timestamp prior to using date()? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 12, 2006 Share Posted December 12, 2006 You don't need to, date defaults to the current time if you don't give it a timestamp. But you can try this and see if it's any different (it should be the same as calling date without a timestamp though):date("Y-m-d", time()); Link to comment Share on other sites More sharing options...
vanyok Posted December 12, 2006 Author Share Posted December 12, 2006 justsomeguy, you're awsome, dude, as always Link to comment Share on other sites More sharing options...
reportingsjr Posted December 12, 2006 Share Posted December 12, 2006 Or it could be that you are setting the mysql column type as timestamp. That would do it. Link to comment Share on other sites More sharing options...
sivanath.nagendran Posted December 13, 2006 Share Posted December 13, 2006 Hi Vanyok Directly you can store the current system time whenever User will click the button to your DB. It is possible by using the now() function in Insert statement. It's a DB function. You just add this function to your Insert statement thats all.I hope this will help you. 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