Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins REST interface - Timestamp Format

Tags:

php

jenkins

I try to build a little web page to get some informations about my Jenkins Jobs and there Builds. The API is really nice so to get the informations is pretty easy.

But, if i request the timestamp for a build - i get something i cant handle with.

For example, I have build that was done on 09.04.2014 08:32:31 (in the Jenkins Web GUI) The returned timestamp of this date is "1397025151000".

If I convert this timestamp to date via PHP i get following:

echo (date("H:i:s - m.d.y", 1397025151000));
// result: 00:50:00 - 10.14.06

I couldnt finde anything about the timestamp in Jenkins - so maybe you can help me.

Thanks

like image 412
christopo Avatar asked Jun 19 '14 14:06

christopo


1 Answers

Right idea with the unix timestamps. But Jenkins uses milliseconds for the unit, and not seconds. So you need to knock off the last few zeros which can be easily done by dividing by 1000. Then date should be happier.

like image 169
Steven V Avatar answered Sep 28 '22 08:09

Steven V