Telligent’s Community Server has a REST API that allows developers to tap into almost every aspect of the database. While creating an importer for WordPress I was attempting to backfill posts with the correct publish date. Telligent provides the publish date through a field called PublishedDate, however in its default format the date is not very useful. The default date from the API looks similar to:
/Date(1273255122713-0400)/
(Yes, including the slashes!)
WTF is that???
After spending a couple hours wrangling the data I finally got it to a place where it was close to the correct post time, however it was always off by a couple hours. This caused issues when rewriting inter-post links as the day of the post was sometimes incorrect, thus causing the year/month/day permalink to be invalid.
Then I found a hidden API parameter that solved all my issues…
Add UseIsoDateFormat=true to the the URL parameters and the following ISO date format will be returned:
yyyy-mm-ddThh:mm:ss
From there it is easy peazy to convert it into any format you may need.
Happy hacking!