1

I have a MySQL-Table with lots of dates in it. In my query I'm getting the date in the format YYYY-MM-DD.

$date = $sql->getValue("date");

echo $date;
// Output: 2016-12-19

Is it possible to get an output like Monday, 19.12.2016?

Yousaf
  • 27,861
  • 6
  • 44
  • 69
Marcus Bauer
  • 45
  • 2
  • 4
  • Yes it's possible in SQL only. To accomplish this you'd use [`DATE_FORMAT`](http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_dayname) `select DATE_FORMAT('2016-12-19','%W %d.%m.%Y')` returns: `Monday 19.12.2016` http://sqlfiddle.com/#!9/03e686/8/0 – xQbert Dec 19 '16 at 21:55
  • Thank you! Is there a way to get the Weekday in German? – Marcus Bauer Dec 19 '16 at 22:03
  • http://dev.mysql.com/doc/refman/5.7/en/locale-support.html may explain it better than I can in a comment something like `SET lc_time_names='de_DE'` may do it. though it depends on the German variant you want. – xQbert Dec 19 '16 at 22:08

0 Answers0