TimeStamp to JulianDay

Hello,

I receive data with 4 information, Lat/Long/Height/Time but the time is formated as Time Stamp eg: 1545130353

How can I use it Inside my new Cesium.SampledProperty?

property.addSample(???, new Cesium.Cartesian3(long, lat,height));

thank you very much for your help

I think what you’ve got there is the number of seconds since the Unix epoch (which is January 1 1970). To convert it to the current date in JavaScript you would do:

new Date(1545130353 * 1000); // Since Date takes milliseconds we multiply by 1000.

``

You can then use the JulianDate.fromDate to create a date object in Cesium from that:

https://cesiumjs.org/Cesium/Build/Documentation/JulianDate.html?classFilter=Julian#.fromDate

Which would look like:

Cesium.JulianDate.fromDate(new Date(1545130353 * 1000));

``

Making your final code:

var julianDate = Cesium.JulianDate.fromDate(new Date(1545130353 * 1000));

property.addSample(julianDate, new Cesium.Cartesian3(long, lat,height));

``

Hope that helps!

hello, yes it help me a lot, thank you very much!!