Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6153649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:07:41+00:00 2026-05-23T20:07:41+00:00

Possible Duplicate: PHP/MySQL – Format date/time I have input field (name:day1 and varchar) to

  • 0

Possible Duplicate:
PHP/MySQL – Format date/time

I have input field (name:day1 and varchar) to enter date in my form. It attached with a jquery calendar and picks the date in the format “D, dd M, yy” (I WANT TO PICK LIKE THIS AND CANT CHANGE FORMAT). I want to convert and save into mysql date format into table. How is this possible?

$insert_query = 'insert into '.$this->tablename.'(
            venue,
            day1,
            day2,
            day3,
            day4,
            day5,
            day6,
            day7,
            day8,
            day9,
            day10,
            city,
            contactperson,
            )
            values
            (
            "' . $this->SanitizeForSQL($formvars['venue']) . '",
            "' . $this->SanitizeForSQL($formvars['day1']) . '",
            "' . $this->SanitizeForSQL($formvars['day2']) . '",
            "' . $this->SanitizeForSQL($formvars['day3']) . '",
            "' . $this->SanitizeForSQL($formvars['day4']) . '",
            "' . $this->SanitizeForSQL($formvars['day5']) . '",
            "' . $this->SanitizeForSQL($formvars['day6']) . '",
            "' . $this->SanitizeForSQL($formvars['day7']) . '",
            "' . $this->SanitizeForSQL($formvars['day8']) . '",
            "' . $this->SanitizeForSQL($formvars['day9']) . '",
            "' . $this->SanitizeForSQL($formvars['day10']) . '",
            "' . $this->SanitizeForSQL($formvars['city']) . '",
            "' . $this->SanitizeForSQL($formvars['contactperson']) . '",
            )';

day 1 to day 10 are the dates want to convert…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:07:42+00:00Added an answer on May 23, 2026 at 8:07 pm

    or in the sql statement you can do that:

    $insert_query = 'insert into '.$this->tablename.'(             
        venue,             
        day1,             
        day2,             
        day3, 
        (.......) )             
        values             
        ("' . $this->SanitizeForSQL($formvars['venue']) . '",             
         STR_TO_DATE("' . $this->SanitizeForSQL($formvars['day1']) . '","%W, %d %M, %y"),             
         STR_TO_DATE("' . $this->SanitizeForSQL($formvars['day2']) . '","%W, %d %M, %y"),
         STR_TO_DATE("' . $this->SanitizeForSQL($formvars['day1']) . '","%W, %d %M, %y"),   
         (.......) )';
    

    The “%W, %d %M, %y” bit must be in the same format as the date you get from your calendar…

    To check all date functions and dates format see these links:

    http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format

    http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_str-to-date

    I hope that helps…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP MySQL Search And Order By Relevancy Hi, I have a table
Possible Duplicate: Format mysql datetime with php How to convert the following: 2010-12-07 12:00:00
Possible Duplicate: highlighting search results in php/mysql I am doing a search with a
Possible Duplicate: How I can create installer for website. PHP mysql I'm looking to
Possible Duplicate: insert multiple rows via a php array into mysql I know about
Possible Duplicate: Best practice: Import mySQL file in PHP; split queries How to import
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I have
Possible Duplicate: php warning mysql_fetch_assoc I have a weird problem about my script. It
Possible Duplicate: PHP code to convert a MySQL query to CSV Hi I am
Possible Duplicate: Best way to store password in database I have a database (mySQL)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.