Solved

Update date field in MySql

Posted on 2014-01-19
4
823 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 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 83

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

739 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