954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem converting and saving date.

What am I doing wrong?
I've stored the date in american format (yyyy-mm-dd) and want to output it in european format (dd-mm-yyy).

This is my code.

//ZENDING
$result = mysql_query("select ID, Bestemming, Afkorting, Datum FROM Zendingen WHERE ID ='" . $znding . "' ORDER BY ID, Bestemming ASC") OR DIE ( mysql_error() ); 

while($row = mysql_fetch_array($result))
  {
  $datumzending = $row['Datum'];
  echo $row['Bestemming'];
  echo date("Y-m-d",$datumzending); 
  echo "";
  echo "";
  }


Thanks in advance!

Stickie
Light Poster
28 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 
echo date("d-m-Y", $datumzending);
pritaeas
Posting Expert
Moderator
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

the problem is that it always shows up as 1-1-1970, why is that?

Stickie
Light Poster
28 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

Then it was not inserted correctly (NULL). It is a date column ?

pritaeas
Posting Expert
Moderator
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 
Then it was not inserted correctly (NULL). It is a date column ?

Yes it is...
Weird thing :( any info you need?

Stickie
Light Poster
28 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

Can you give an example of your insert query ?

pritaeas
Posting Expert
Moderator
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 
Can you give an example of your insert query ?

The input should be fine. It is a custom made table like thing which i handed out to someone else.
it inputs the data fine.

BTW: Solved

It called for the wrong attribute ;) Sorry for wasting your time!

Stickie
Light Poster
28 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: