Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP: How to display date time in following format (2015-01-05T06:27:50.000Z )?

Tags:

php

datetime

I want to show the datetime in the following format

2015-01-05T06:27:50.000Z 

How I can achieve this ?

like image 612
Qazi Avatar asked Jan 06 '15 05:01

Qazi


2 Answers

Try this:

<?php echo date("Y-m-d\TH:i:s.000\Z", strtotime("2015-01-05 06:27:50")); ?> 
like image 167
Priyank Avatar answered Sep 20 '22 12:09

Priyank


If you want to include the right timezone offet:

date('Y-m-d\TH:i:s\.Z\Z');
like image 29
Thomas Decaux Avatar answered Sep 19 '22 12:09

Thomas Decaux