Jump to content

Recommended Posts

hi heres my sql

 

$PortSQL = mysql_query("SELECT * FROM tblPortfolio WHERE PortCurrent='0' ORDER BY PortDateAdded DESC") or die(mysql_error());

 

when i get my result the dates go like such

 

21/02/08

20/09/07

18/02/08 

17/01/08 

10/11/07

 

so its going 21,20,18,17,10

 

not by actual date, is this becuase my field type is not date?

 

its changed all my dates to

 

2021-02-08 

2020-09-07

2018-02-08

2017-01-08

2010-11-07

 

and i cant manually change them back

 

does it have to be Year month day? in mysql then you format it with code?

 

 

Okay, change it back and try this

 

1. rename the current date field to olddate

2. create a new field called newdate

3. query this (update table to the table name)

UPDATE table SET newdate = STR_TO_DATE(olddate, '%d/%m/%Y');

4. check the values of newdate

 

Note always keep a backup

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.