Using NVD3: Converting DHIS2 dates to Unix Time Stamp format

Hi Devs

I’m trying to set up a line chart using NVD3 (similar to example http://nvd3.org/examples/cumulativeLine.html) which requires JSON date values in the Unix Time Stamp format. Has anyone solved this date format issue before? Source data coming from DHIS2 is returned as 2012-06-27 00:00:00 while the expected Unix Time Stamp format value is 1340755200000.

Greg

···

Health Information Systems Program - South Africa

**- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - **

Mobile : 073 246 2992
Landline: 021 554 3130
Fax: 086 733 8432
Skype: gregory_rowles

Try with

new Date(“2012-06-27 00:00:00”).getTime()

···

On Tue Jan 13 2015 at 4:53:12 PM Greg Rowles greg.rowles@gmail.com wrote:

Hi Devs

I’m trying to set up a line chart using NVD3 (similar to example http://nvd3.org/examples/cumulativeLine.html) which requires JSON date values in the Unix Time Stamp format. Has anyone solved this date format issue before? Source data coming from DHIS2 is returned as 2012-06-27 00:00:00 while the expected Unix Time Stamp format value is 1340755200000.

Greg

Health Information Systems Program - South Africa

**- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - **

Mobile : 073 246 2992
Landline: 021 554 3130
Fax: 086 733 8432
Skype: gregory_rowles


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Easy solution there! Thanks Morten!

···

On Tue, Jan 13, 2015 at 11:54 AM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try with

new Date(“2012-06-27 00:00:00”).getTime()

On Tue Jan 13 2015 at 4:53:12 PM Greg Rowles greg.rowles@gmail.com wrote:

Hi Devs

I’m trying to set up a line chart using NVD3 (similar to example http://nvd3.org/examples/cumulativeLine.html) which requires JSON date values in the Unix Time Stamp format. Has anyone solved this date format issue before? Source data coming from DHIS2 is returned as 2012-06-27 00:00:00 while the expected Unix Time Stamp format value is 1340755200000.

Greg

Health Information Systems Program - South Africa

**- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - **

Mobile : 073 246 2992
Landline: 021 554 3130
Fax: 086 733 8432
Skype: gregory_rowles


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Health Information Systems Program - South Africa

**- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - **

Mobile : 073 246 2992
Landline: 021 554 3130
Fax: 086 733 8432
Skype: gregory_rowles