Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date changes format when submitted...HELP

Status
Not open for further replies.

shamrox

Programmer
Sep 27, 2001
81
US
Got a form in Dreamweaver for date. User needs to be able to key in the date as MM-DD-YYYY, but it gets inserted into the MySQL table as YYYY-MM-DD, but the numbers are all messed up. meaning it doesn't just turn them around...

What am I doing wrong? Is there some sort of code i need to use to change the format around??

 
Basically, you need to send date information formatted as YYYY-MM-DD or YYYY/MM/DD. You have to provide script code to perform the transformation.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Insufficient data for a meaningful answer.

One possibility is client-side scripting.

Another possibility is server-side programming at the script to which the data is submitted.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
How is this insufficient data?

I have a form field for date. I want them to be able to key in 08/10/2004 and submit the record to the database. If I do that now, it goes into the database as 2008-10-04.

I need it to go in as 2004-08-10.

is there a way to convert?

 
There is still insufficient data for a meaningful answer.

With the inclusion of "Dreamweaver" in your question, I have assumed a web interface.

From that I infer that this data will be submitted to a web script for processing. That web script would be a good place to perform the transformation, but it's very difficult to advise you when possible programming languages for web scripts include c-language, PHP, python, perl, VBScript/ASP, Java and server-side JavaScript.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
With PHP, you could use

[tt]
$the_date = date( "Y-m-d", strtotime($the_date));
[/tt]

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Completely understood, but might as well save the trouble of waiting for him/her to post there so we can answer it there.

Although, if someone has a future PHP question regarding this topic, I'm sure they won't search in the MySQL AB: MySQL forum.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
shamrox-

Just post your available code and question in forum434, so that we can help you, and the next person who has this question can also seek help.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top