Languages

Menu
Sites
Language
web widget: am/pm format

Hi Guys!

 

I have an issue with obtaining am/pm time format in widget. I know for web app sdk supplies tizen.time.getTimeFormat(), but die to limitations of web widget(https://developer.tizen.org/development/api-references/web-application?redirect=/dev-guide/2.3.2/org.tizen.web.apireference/html/widget_spec/web_widget.html#user-content-web-device-api) I can't use this feature.

Do you have any ideas how to get info about time format in web widget? I cant beleive that such simple and required thing isnt implemented in widget.

 

Best regards,

Mykhailo

 

Responses

4 Replies
André Reus

Hello

Your answer is here https://developer.tizen.org/forums/web-application-development/display-time-ampm

You can also see the Alarm Widget from Online Sample. 

M Z

Hello André,

Thnx for help,

but as I described my problem above we can't use tizen.time.getTimeFormat() because its available only in web app, not web widget. So the question still open.

André Reus

What about this ?

   var datetime = tizen.time.getCurrentDateTime(),
        hour = datetime.getHours(),
        minutes = datetime.getMinutes();
        var amPm= 'AM';
        if(hour >=13 && hour <=23){
            amPm= 'PM';
            hour= hour-12;
        }
        if(hour == 12){
            amPm= 'PM';
        }
        if(hour === 0){
            hour=12;
        }
        console.log("current time is: " +hour+":"+minutes+ amPm);

 

M Z

Hi André,

its very very odd (or actually as ususal) from samsung side to limit functionality, but the object tizen.time is undefined for web widget.