Jump to content

[SOLVED] php date help


jamesxg1

Recommended Posts

ok i have a javascript calendar and the user selects the date ect ect and then it imputs it into mysql, well it inputs it like so. . . 11-APR-2009 and it uses short terms for the months how do i make a array or anything that will change the JAN,FEB,DEC,APR ect to the real month names before it is entered into mysql ?, thanks

 

James.

Link to comment
Share on other sites

Mysql DATE types are yyyy-mm-dd. Anything else makes for excess storage requirements, complicated queries and complicated presentation code, and slow queries.

 

You should probably explode your entered date format, convert the abbreviated month names into numbers using an array, then check for a valid date using checkdate, then format the parts into a yyyy-mm-dd format to put into your query.

Link to comment
Share on other sites

Mysql DATE types are yyyy-mm-dd. Anything else makes for excess storage requirements, complicated queries and complicated presentation code, and slow queries.

 

You should probably explode your entered date format, convert the abbreviated month names into numbers using an array, then check for a valid date using checkdate, then format the parts into a yyyy-mm-dd format to put into your query.

 

ermmm im really confused :S, im not at all that good with php :S

 

would this be what you mean ?

 

<?php print_r(explode('-', $fromdat, 2)); ?>

Link to comment
Share on other sites

Please do not spam saying something is urgent.  If it's so urgent, hire someone.

 

spam :S, what do you mean ?, i haven't spammed this thread ?

 

james, you have posted 3 times in less than 15 minutes, relax, be patient, and wait for a reply.  The more you bump post your thread, the less likely you'll get a response.

Link to comment
Share on other sites

Please do not spam saying something is urgent.  If it's so urgent, hire someone.

 

spam :S, what do you mean ?, i haven't spammed this thread ?

 

james, you have posted 3 times in less than 15 minutes, relax, be patient, and wait for a reply.  The more you bump post your thread, the less likely you'll get a response.

 

hmmmm.... i guess your right, yea ok agreed sorry admin wont happen again.

Link to comment
Share on other sites

You started a thread.  About 7 minutes later, you post again.  About 7 minutes later, you post again. That's called spamming.

 

i know i see your point, i am sorry, it wont happen again, trust me i have taken that into account :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.