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

  • Home
  • SEARCH
  • 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 7638627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:13:15+00:00 2026-05-31T08:13:15+00:00

I have a PHP/MySQL date formatting problem. Here, i create the date variables: $checkDate

  • 0

I have a PHP/MySQL date formatting problem. Here, i create the date variables:

$checkDate = date("d/m/y H:i", time());
$datestrto = strtotime($checkDate); 

Then i insert it to a mysql table with the column Datatype of bigint.

When i then, later on, when i need to echo the date, i use this code:

echo '<td>'.date("d/m/y H:i",$row['f_uploaded_date']).'</td>';

But istead of echo’ing the date in the format D/M/Y H:i, it echo’es the date in the format of m/d/y H:i.
Can anyone explain why this is happening, and how to fix it?

Thank you in advance,
Adam

  • 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-31T08:13:16+00:00Added an answer on May 31, 2026 at 8:13 am

    When you insert it into the MySQL table do it like this:

    INSERT INTO yourtable(something,somedate) VALUES('something',str_to_date('".$checkDate."','%d/%m/%y %H:%i'))
    

    and when you pull it out from MySQL then do it like this:

    SELECT *,date_format(somedate,'%D/%M/%Y %H:%i') as formateddate from yourtable
    

    then in php you use:

    $row['formateddate']
    

    Hope it helps you 🙂

    EDIT:
    The complete code:

    $ddate = date("d/m/y H:i", time()); 
    $sql = "INSERT INTO files (rowID, file, mimetype, data, uploaded_by, uploaded_date, size, times_downloaded, description) VALUES (NULL, '$fileName', '$fileType', '$content', '$user', str_to_date('".$ddate."','%d/%m/%y %H:%i'), $fileSize, 0, '$description')";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP/MySQL - Format date/time I have input field (name:day1 and varchar) to
Ello, I am struggling with some date troubles here in PHP/MySql. I have a
i work with php/Mysql i have table with two cols (date , cash) with
I have a table which will have a date/time column to store create date
Possible Duplicate: php/Mysql query with inserting date fails I have a datepicker code below:
We have a PHP/MYSQL application that collects user input, including special characters like ø,ü,ñ,
I have a legacy PHP/MySQL app that calls mysql_connect(). Tons of existing downstream code
I currently have a news website setup in PHP/MYSQL that's a bit old and
I am programming in PHP mysql. I have recently got into OOP programming. So
I am used to developing in PHP/MySQL and have no experience developing with SQL

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.