Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Update date field in MySql

Posted on 2014-01-19
4
Medium Priority
?
866 Views
Last Modified: 2014-01-19
What a huge @#$%^ mistake.

I took on converting a @#$%^ asp site to php.

Is there any @#$%^ way to update a date field?

PHP or MySQL just wants to update to 0000-00-00 00:00:00

What if 0000-00-00 00:00:00 doesn't work for you?  Let's say someone wasn't born on 0000-00-00 00:00:00 or they didn't start employment on 0000-00-00 00:00:00?  Can @#$%^! MySQL or PHP handle any date other than 0000-00-00 00:00:00?

Even more of a huge leap... can the field not contain a time?

Is there a way in which could look at the field and just see 1/19/2014?
0
Comment
Question by:classnet
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 39792580
MySQL Date format is YYYY-MM-DD and Time is HH:MM:SS.  Those formats are easy to rearrange for display in PHP but MySQL doesn't want to see any other formats.  Yes, I know the page says it will accept other formats but good luck with that.

MySQL has DATE, TIME, and DATETIME data types.

http://dev.mysql.com/doc/refman/5.6/en/date-and-time-types.html

PHP date function with formatting.

http://us2.php.net/manual/en/function.date.php
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39792583
Do you really think php can't accept datetimes different from 0000-00-00 00:00:00? It's evident there is omething wrong with your code. Post it here and maybe we can help.
0
 

Author Closing Comment

by:classnet
ID: 39792597
Thanks dude... time to stop for a while.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39792619
You're welcome.  You are working on a somewhat difficult task.  There is a difference of viewpoints between Classic ASP and PHP.  It would be worse if it were ASP.NET...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question