-1

I have stored time of comment in DB as time(); now I need to use that to be able to use JQUERY TIME AGO PLUGIN. But not have any idea as how to convert it in to "2008-07-17T09:24:17Z" format so it can be used in plugin.

Kundan Singh
  • 83
  • 10

2 Answers2

1

In php,

 $isostring = date('c',$timevalue);

gets you the ISO8601 string. See here: http://php.net/manual/en/function.date.php

T is a separator splitting the date from the time. Z is a timezone indicator, meaning so-called Zulu time. That's aviator shorthand for the null timezone, also known as Universal Time Coordinated (UTC) formerly known as Greenwich Mean Time (GMT).

O. Jones
  • 103,626
  • 17
  • 118
  • 172
0

PHP has several constants that are used to covert to common date formats. Assuming you are accessing the time from a database, you can use strtotime() to convert and then use the DATE_ISO8601 constant in PHP.

$dateformatted = date(DATE_ISO8601, strtotime($datefromdatabase));
Ramsay Smith
  • 1,098
  • 13
  • 30