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 667863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:58:32+00:00 2026-05-13T23:58:32+00:00

MySQL stores the date in my database (by default) as ‘YYYY-MM-DD’ The field type

  • 0

MySQL stores the date in my database (by default) as ‘YYYY-MM-DD’ The field type for my date is ‘DATE’ (I do not need any time storage).. Is there a simple way to change it by default to DD/MM/YYYY ?

I call up different dates in 2 different tables, and no where in any of my code do I have anything resembling a date variable or anything! Hopefully this is a straight forward change?

  • 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-13T23:58:32+00:00Added an answer on May 13, 2026 at 11:58 pm

    In PHP, you could :

    • Transform the date to a timestamp, using strtotime
    • Format it, using date

    A bit like this, I’d say :

    $timestamp = strtotime($date_from_db);
    echo date('d/m/Y', $timestamp);
    

    But this will only work for dates between 1970 and 2038, as timestamps are stored as 32 bits integers, counting from 1970-01-01.

    In MySQL, I suppose the [`date_format`][4] function would do the trick.

    For example :

    mysql> select date_format(curdate(), '%d/%m/%Y');
    +------------------------------------+
    | date_format(curdate(), '%d/%m/%Y') |
    +------------------------------------+
    | 19/03/2010                         |
    +------------------------------------+
    1 row in set (0.03 sec)
    

    And, for the sake of completness, another solution, in PHP, that doesn’t suffer from the limitation of 1970-2038 would be to use the `DateTime` class, and, especially :

    • DateTime::__construct to parse the date returned by the DB
    • DateTime::format to format the date to whatever format you want.

    For example, this portion of code :

    $date = new DateTime('2010-03-19');
    echo $date->format('d/m/Y');
    

    would get you this output :

    19/03/2010
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My MySQL database has date of birth stored in the format yyyy-mm-dd, how do
I have an order table in MySQL database, having a field/column which stores the
I have a MySQL database table that has a VARCHAR field storing a date
Ok, I am storing a Date/Time in a MySQL TEXT field. I want to
I have a date I need to store in a date field in mysql.
I have written a stand-alone script that stores dates (Date type field) in a
Scenario: My PHP application will always use the date field DD-MM-YYYY. MySQL obviously always
Can any body tell me how can I store Java Date to Mysql datetime...?
I need to create a table in MySQL which stores the different currency symbols
I have a MySql database that stores a timestamp for each record I insert.

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.