AviNahum Posted February 13, 2013 Share Posted February 13, 2013 i trying to rewrite a whole js file into php code and i have some issues with a few functions Date.prototype.ConvertToUTCDate = function() { var utcDate = new Date(this.getUTCFullYear(), this.getUTCMonth(), this.getUTCDate(), this.getUTCHours() + WinnerConsts.TIME_ZONE, this.getUTCMinutes(), this.getUTCSeconds()); return utcDate; } parseLineDates: function(lgObj) { lgObj.FullDate = parseInner(lgObj.FullDate); lgObj.Day = parseInner(lgObj.Day); lgObj.Time = parseInner(lgObj.Time); function parseInner(d) { d = d.substr(6); d = parseInt(d); d = (new Date(d)).ConvertToUTCDate(); return d; } } function fromUTCArray(A) { var D = new Date; while (A.length < 7) A.push(0); var T = A.splice(3, A.length); D.setUTCFullYear.apply(D, A); D.setUTCHours.apply(D, T); return D; } // ReParsing from Json Cloning. function parseLineDates(lgObj) { lgObj.FullDate = parseInner(lgObj.FullDate); lgObj.Day = parseInner(lgObj.Day); lgObj.Time = parseInner(lgObj.Time); function parseInner(d) { //return new Date(Date.parse(d)); return parseTest(d); } } function parseTest(s) { var D, M = [], hm, min = 0, d2, Rx = /([\d:]+)(\.\d+)?(Z|(([+\-])(\d\d)\d\d))?)?$/; D = s.substring(0, 10).split('-'); if (s.length > 11) { M = s.substring(11).match(Rx) || []; if (M[1]) D = D.concat(M[1].split(':')); if (M[2]) D.push(Math.round(M[2] * 1000)); // msec } for (var i = 0, L = D.length; i < L; i++) { D[i] = parseInt(D[i], 10); } D[1] -= 1; while (D.length < 6) D.push(0); if (M[4]) { min = parseInt(M[6]) * 60 + parseInt(M[7], 10); // timezone not UTC if (M[5] == '+') min *= -1; } try { d2 = fromUTCArray(D); if (min) d2.setUTCMinutes(d2.getUTCMinutes() + min); } catch (er) { // bad input } return d2; } i dont have any idea how to convert this into PHP and would like to get some help... Thank in advanced and sorry for poor english... Quote Link to comment Share on other sites More sharing options...
AviNahum Posted February 14, 2013 Author Share Posted February 14, 2013 up.. please Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 14, 2013 Share Posted February 14, 2013 Don't bump your posts. You haven't provided any PHP code. If you want this done, make an attempt, or post in freelance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.