<![CDATA[ How to get value of date fields in milliseconds - My Forums]]> https://forums.modx.com/thread/?thread=89137 <![CDATA[How to get value of date fields in milliseconds]]> https://forums.modx.com/thread/89137/how-to-get-value-of-date-fields-in-milliseconds#dis-post-490100
I am attempting to build a calendar system using a Bootstrap 3 (and 2) JavaScript calendar.

I plan to use Resources (in combination with Collections) to build events and use getResources to build out the appropriate JSON file that the Calendar gets it's events from.

A typical example of a JSON event is:

{
 "id": "293",
 "title": "This is information class event",
 "url": "http://www.example.com/",
 "class": "event-info",
 "start": "1362938400000",
 "end":   "1363197686300"
}


Easy enough to use Resource and template variables to build this but, not being a programmer, I'm not sure how to convert the value of the Date TVs into milliseconds, as required in the JSON entry for each event.

If I select say February 16, 2014, 12:00pm using a Date type TV with an output to default I get:

2014-02-16 12:00:00

Which is great of course.

Setting the output to default I know we can use the typical %Letter syntax, but I don't see how to use that to create a millisecond output.

Any suggestions?]]>
rx2 Feb 14, 2014, 03:45 PM https://forums.modx.com/thread/89137/how-to-get-value-of-date-fields-in-milliseconds#dis-post-490100
<![CDATA[Re: How to get value of date fields in milliseconds]]> https://forums.modx.com/thread/89137/how-to-get-value-of-date-fields-in-milliseconds#dis-post-490108 millisecond converter site.

The output was: 1392573600000 which translated to: Sun Feb 16 2014 13:00:00 GMT-0500 (Eastern Standard Time).

So I suspected it was a date_timezone system/context setting issue.

Set a context setting of date_timezone to US/Eastern and the result now is: 1392570000000 which translates properly to: Sun Feb 16 2014 12:00:00 GMT-0500 (Eastern Standard Time).]]>
rx2 Feb 14, 2014, 04:56 PM https://forums.modx.com/thread/89137/how-to-get-value-of-date-fields-in-milliseconds#dis-post-490108
<![CDATA[Re: How to get value of date fields in milliseconds (Best Answer)]]> https://forums.modx.com/thread/89137/how-to-get-value-of-date-fields-in-milliseconds#dis-post-490104
[[+yourTV:strtotime]]000
]]>
Bruno17 Feb 14, 2014, 03:54 PM https://forums.modx.com/thread/89137/how-to-get-value-of-date-fields-in-milliseconds#dis-post-490104