I solved it, date() won’t work because I didn’t want the current date.
$date = $post->post_date_gmt; fixed the problem
Thank you! This help alot,but only if i defined $date manually…
This works: $date = “2010-01-01”;
But this doesn’t: $date = the_date(‘Y-m-d’);
I don’t see why there should be a difference?