0
Mon Apr 20 00:00:00 CEST 2015

How can I convert this to 20.04.2015 with Javascript?

Ive updated the Backend in a Webclient, before this, the following function run perfectly, but jet is another datetime convert.. Before the Update the Datetime was an SQL Date like this 2015-04-12T00:00:00.000

<script>
       var php = '{{SYSDATE}}';
       var i = php.slice(0,10).split('-');
       var sysdate = i[2]+'.'+i[1]+'.'+i[0];
</script>

Here is the HTML for this function:

 <span class="sysdatestamp"><script type="text/javascript">document.write(sysdate)</script></span>

1 Answers1

0

Use php date_format function:

date_format ( date_create('2015-04-12T00:00:00.000') , 'd.m.Y' );

PHP: date_format - Manual

Gabriel Moretti
  • 676
  • 8
  • 23