home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
WebService and Mobile Access
Popular Plugins
MPExtended
UTC Dates Out -> Local Time In?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="johanj" data-source="post: 1115235" data-attributes="member: 88055"><p>Hi</p><p></p><p>It's been a while since I made the date/time parts for tv. Checking through the javascript code I see that the time should be given in ISO_8601 format for MPExt. In javascript I use the below conversion methods. When recording a program with 'AddScheduleDetailed' I use this to get the time string for 'startTime and 'endTime':</p><p></p><p>self.getISODateString(self.getDateFromMPDateTime(data.StartTime))</p><p></p><p>data.StartTime is in the response from 'GetProgramBasicById'</p><p></p><p>Hope this helps.</p><p></p><p>Btw, I have not really used your MB3 plugin yet so I can't give you much test results. Channels are in correct order now. Several times the I get messages that MB3 server couldn't get the tv data. I noticed that the MB3 server log has a lot of exceptions from your plugin. I can upload it later.</p><p></p><p></p><p>Johan</p><p></p><p>[code]self.getDateFromMPDateTime = function(dateTime) {</p><p> try {</p><p> return new Date(parseInt(dateTime.substring(6, 24)));</p><p> } catch (e) {</p><p> CF.log("Exception caught while creating Date: " + e);</p><p> return "date error";</p><p> }</p><p> };</p><p></p><p> self.getDateFromISOTime = function(dateString) {</p><p> var ISO_8601_re = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/;</p><p> var m = dateString.match(ISO_8601_re);</p><p></p><p> var year = +m[1];</p><p> var month = +m[2];</p><p> var dayOfMonth = +m[3];</p><p> var hour = +m[4] - 1;</p><p> var minute = +m[5];</p><p> var second = +m[6];</p><p></p><p> var myDate = new Date();</p><p> myDate.setUTCFullYear(year);</p><p> myDate.setUTCMonth(month - 1);</p><p> myDate.setUTCDate(dayOfMonth);</p><p> myDate.setUTCHours(hour);</p><p> myDate.setUTCMinutes(minute);</p><p> myDate.setUTCSeconds(second);</p><p></p><p> return myDate;</p><p> }</p><p></p><p>self.getISODateString = function ISODateString(d) {</p><p> var d2 = new Date(d.getTime());</p><p> return d2.toISOString();</p><p> };[/code]</p></blockquote><p></p>
[QUOTE="johanj, post: 1115235, member: 88055"] Hi It's been a while since I made the date/time parts for tv. Checking through the javascript code I see that the time should be given in ISO_8601 format for MPExt. In javascript I use the below conversion methods. When recording a program with 'AddScheduleDetailed' I use this to get the time string for 'startTime and 'endTime': self.getISODateString(self.getDateFromMPDateTime(data.StartTime)) data.StartTime is in the response from 'GetProgramBasicById' Hope this helps. Btw, I have not really used your MB3 plugin yet so I can't give you much test results. Channels are in correct order now. Several times the I get messages that MB3 server couldn't get the tv data. I noticed that the MB3 server log has a lot of exceptions from your plugin. I can upload it later. Johan [code]self.getDateFromMPDateTime = function(dateTime) { try { return new Date(parseInt(dateTime.substring(6, 24))); } catch (e) { CF.log("Exception caught while creating Date: " + e); return "date error"; } }; self.getDateFromISOTime = function(dateString) { var ISO_8601_re = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/; var m = dateString.match(ISO_8601_re); var year = +m[1]; var month = +m[2]; var dayOfMonth = +m[3]; var hour = +m[4] - 1; var minute = +m[5]; var second = +m[6]; var myDate = new Date(); myDate.setUTCFullYear(year); myDate.setUTCMonth(month - 1); myDate.setUTCDate(dayOfMonth); myDate.setUTCHours(hour); myDate.setUTCMinutes(minute); myDate.setUTCSeconds(second); return myDate; } self.getISODateString = function ISODateString(d) { var d2 = new Date(d.getTime()); return d2.toISOString(); };[/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
WebService and Mobile Access
Popular Plugins
MPExtended
UTC Dates Out -> Local Time In?
Contact us
RSS
Top
Bottom