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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:24:01+00:00 2026-05-27T11:24:01+00:00

EDIT The format in the .csv excel file for the date was 15-12-2011 and

  • 0

EDIT
The format in the .csv excel file for the date was 15-12-2011 and in the MySQL phpmyadmin database the column type was set to DATE so if I imported the file all data in date column changed to 0000-00-00. I did the next to fix this, went into the .csv file and selected the column for date and changed the format to ‘Africa’ so it would change everything from d-m-Y to Y-m-d. So in the .csv it would become 2011-12-15 instead of 15-12-2011. After importing it again the date was correctly imported without turning to 0000-00-00.

After that I Changed the ORDER BY in index.php:

$query = mysql_query("SELECT * FROM `newitems` ORDER BY startVisible DESC LIMIT $start, $per_page");

After that I changed the format date where was needed.

Available from: <?php 
                        $timestamp = strtotime($query_row["startVisible"]);
                        echo date("d-m-Y", $timestamp);
                        ?>

These scripts would first change the order by 1.year 2.month 3.day and after that change the format so it would echo 15-12-2011 instead of 2011-12-15 (how it is saved in the database)

Hope this will help others with the same problem.

Cheers.

below = question I asked

I have exported a table and modified some things that needed to be modified. Next I tried to import them into the table again but startVisible column Type was set to date. All my dates where stored as 0000-00-00. All my dates in the csv file are like 15-12-2011. I’ve changed the column Type to varchar and after that I could import the csv file with everything as 15-12-2011 I wanted to sort everything by date in http://www.domain.com/index.php. That is because the column type is not set to DATE. So I Changed the Column type from VARCHAR to DATE again and all the dates changed to 0000-00-00.
So no matter what I did everything changed to 0000-00-00. I removed everything and imported the same file and all the dates where imported correctly. So it may be a MySQL load fail or something.

I used:

$query = mysql_query("SELECT * FROM newItems ORDER BY startVisible DESC LIMIT $start, $per_page");

But all the dates are mixed now. It has to short them by d-m-Y but does not do that.

9-8-2011
9-3-2011
8-3-2011
7-6-2011
7-3-2011
7-11-2011
6-7-2011

Now everything is sorted correctly but I want to change the order it shows from 2011-12-15 to 15-12-2011. ( I MEAN ON THE WEBSITE not in MySQL ). in index.php I want to show everything as d-m-Y but I still want to sort (ORDER BY) them correctly. How to do that?

Thanks,
F4LLCON

  • 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-27T11:24:02+00:00Added an answer on May 27, 2026 at 11:24 am

    This is because the query is now ordered by a varchar column so it is sorted alphabetically, So try to convert it to a date first:

    select DATE_FORMAT(STR_TO_DATE(startVisible, '%d-%m-%Y'), '%d-%m-%Y') as startDate,... 
    from newItems 
    ORDER BY startDate DESC LIMIT $start, $per_page;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to edit the .fla file code and save it in the .swf format?
I have data stored in a csv file that looks like this: Date,BLOCK,,Wood,Miscellaneous,,Totals,MO Saturday,4055-RU,4055-AR,4091,1139,1158,,100
Our users need to be able to export data in CSV format, edit some
I have a file csv file in this format, I would like to generate
I'm reading a .csv file (I have no control of the format of the
I need to edit format for JFormatedTextField in a Java program. NetBeans are helping
new_story GET /story/new(.:format) {:action=>new, :controller=>stories} edit_story GET /story/edit(.:format) {:action=>edit, :controller=>stories} story GET /story(.:format) {:action=>show,
Anyway of invoking the Edit > Advanced > Format Document VS command automatically when
I am trying to parse a csv file where my data is given in
I have several csv files that I need to transfer over to mdb format.

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.