cleary1981 Posted July 23, 2008 Share Posted July 23, 2008 Hi, I know how to format a date that I have read out of my db using date('d-m-Y',strtotime($row['deadline'])) but when im adding a date value what do I need to do? Link to comment https://forums.phpfreaks.com/topic/116168-adding-a-date-to-mysql-from-php/ Share on other sites More sharing options...
paul2463 Posted July 23, 2008 Share Posted July 23, 2008 what is the datatype for the column you are adding the date too???? Link to comment https://forums.phpfreaks.com/topic/116168-adding-a-date-to-mysql-from-php/#findComment-597407 Share on other sites More sharing options...
MasterACE14 Posted July 23, 2008 Share Posted July 23, 2008 if the column for the date in the database is simply varchar then you can format the date with PHP first, and insert it into the database that way. Link to comment https://forums.phpfreaks.com/topic/116168-adding-a-date-to-mysql-from-php/#findComment-597410 Share on other sites More sharing options...
cleary1981 Posted July 23, 2008 Author Share Posted July 23, 2008 it is in date format. Is it easier to store as varchar? Link to comment https://forums.phpfreaks.com/topic/116168-adding-a-date-to-mysql-from-php/#findComment-597418 Share on other sites More sharing options...
MasterACE14 Posted July 23, 2008 Share Posted July 23, 2008 doesn't really matter, with varchar, you have the flexibility of inserting the date as a string. With a timestamp, it must be of the correct timestamp format. It would probably be easier to use Timestamp. But in saying that. It isn't too hard to create your own custom function to grab your date if it was put into a string column(varchar). Link to comment https://forums.phpfreaks.com/topic/116168-adding-a-date-to-mysql-from-php/#findComment-597423 Share on other sites More sharing options...
TempleDMDKrazd Posted July 23, 2008 Share Posted July 23, 2008 it is in date format. Is it easier to store as varchar? i think timestamp is easier..... Link to comment https://forums.phpfreaks.com/topic/116168-adding-a-date-to-mysql-from-php/#findComment-597431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.