TV system date problem

Hi everybody,
we have a problem retrieving the correct TV system date.
After having set it manually on the TV, we tried to retrieve it with the following code:
var date = new Date();

dateField.setText(date.getDate() + "/" + (date.getMonth() + 1) + " /" + date.getFullYear());

where "dateField" it's a KONtx.element.Text; the problem is that we always get 1/1/1970.
All works fine on the simulator instead.
Probably the reason is that "new Date()" on the TV does not get the system date, and so returns the first date of javascript Date object.
Any suggestions?


1 Reply
  • The method to get the correct time on a TV is the following:


    It returns the unix timestamp in *seconds*. If you then need to use it inside a JS date object for formatting purposes, you would need to multiply that times 1,000 like the following:

    var date = new Date(getRealTime() * 1000);



Recent Posts

in General - Yahoo! TV Widgets