Danny620 Posted November 23, 2009 Share Posted November 23, 2009 wot is the php function to insert a date into the db like 2009-11-23 17:55:17 or sql Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/ Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 When you say a date do you mean the current date/time? PHP can generate it like so... echo date("Y-m-d H:i:s"); Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964155 Share on other sites More sharing options...
ShadowIce Posted November 23, 2009 Share Posted November 23, 2009 Here's a more precise version: <?php echo date('l, F jS Y h:i:s A'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964156 Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 Here's a more precise version: <?php echo date('l, F jS Y h:i:s A'); ?> How is that a more precise way of creating the format "2009-11-23 17:55:17"? Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964157 Share on other sites More sharing options...
ShadowIce Posted November 23, 2009 Share Posted November 23, 2009 B/c it shows: Monday, November 23 2009 12:42 PM Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964159 Share on other sites More sharing options...
PFMaBiSmAd Posted November 23, 2009 Share Posted November 23, 2009 The question that was asked concerns a specific format, not the format you posted. The format you came up with is also unusable for direct database operations and takes more storage space in a database. Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964163 Share on other sites More sharing options...
Danny620 Posted November 23, 2009 Author Share Posted November 23, 2009 thanks that worked how can i put display it as like tue 21 2009 12:11 PM Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964168 Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 date Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964170 Share on other sites More sharing options...
ShadowIce Posted November 23, 2009 Share Posted November 23, 2009 FAIL, cags. -.- Here danny, do this: <?php echo date('D F jS Y h:i:s A'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964174 Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 Erm, no. If anybody failed, that would be you. Again. Since the correct way of outputting what the OP asked for is... echo date("D d Y h:i A"); ... with the possible substitution of j for d, since it's impossible to tell from the value provided. But the point is, what's the point in us explaining every single format when theres a perfectly good manual that does it for us. It's not even like you can say the example in the manual is too complicated (as it is with some topics) since it's one of the simplest things on the site to understand. Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964181 Share on other sites More sharing options...
ShadowIce Posted November 23, 2009 Share Posted November 23, 2009 Um. no it would not. He said he wanted Mon November 23rd 2009 1:03 PM and thats what i gave him. period. Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964183 Share on other sites More sharing options...
PFMaBiSmAd Posted November 23, 2009 Share Posted November 23, 2009 ShadowIce, are you even reading the questions in the threads? You have recently replied in three threads other than your own and in each one you have posted information that does not match the question that has been asked. Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964185 Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 Um. no it would not. He said he wanted Mon November 23rd 2009 1:03 PM and thats what i gave him. period. No, the OP didn't mention the month. thanks that worked how can i put display it as like tue 21 2009 12:11 PM Which is something that would have been very easy to check before your oh so intelligent retort. period. Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964194 Share on other sites More sharing options...
ShadowIce Posted November 23, 2009 Share Posted November 23, 2009 O boy. ONE SMALL mistake. we're all human -.- <?php echo date('D jS Y h:i:s A'); ?> Fixed.. -.- period Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964196 Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 [ot]They also didn't mention seconds or a suffix for the day. So I guess thats THREE SMALL mistakes. But nevermind. To be honest I don't really care and wouldn't normally have even mentioned it. Your the one that brought the attidute with your "FAIL" statement. Regardless, thats enough random shit in this thread.[/ot] Quote Link to comment https://forums.phpfreaks.com/topic/182676-date-help/#findComment-964206 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.