zoukankan      html  css  js  c++  java
  • Titanium系列--利用js动态获取当前时间

    动态获取时间:

    //显示时间

    function getDateTime() {

    var now = new Date();

    var year = now.getFullYear();

    var month = now.getMonth()+1;

    var day = now.getDate();

    //var hour = now.getHours();

    //var minute = now.getMinutes();

    //var second = now.getSeconds();

    if(month.toString().length == 1) {

    var month = '0'+month;

    }

    if(day.toString().length == 1) {

    var day = '0'+day;

    }

    /*

    if(hour.toString().length == 1) {

    var hour = '0'+hour;

    }

    if(minute.toString().length == 1) {

    var minute = '0'+minute;

    }

    if(second.toString().length == 1) {

    var second = '0'+second;

    }*/

    var dateTime = year+'年'+month+'月'+day+'日';//+hour+':'+minute+':'+second;

    return dateTime;

    }

    var label_time = Titanium.UI.createLabel({

    color: 'white',

    font: { fontSize:12 },

    text:getDateTime(),

    top:'7%',

    right:'3%'

    });

    main_win.add(label_time);

    //显示时间结束

  • 相关阅读:
    Flutter 导航栏上添加搜索按钮
    tabController保活
    nav 选项卡
    flutter 毛玻璃
    [题解]CodeForces878 D
    [题解]CodeForces878C Tournament
    [题解]NOIP2012
    bzoj1070题解
    bzoj1061题解
    bzoj1059题解
  • 原文地址:https://www.cnblogs.com/inya/p/4109319.html
Copyright © 2011-2022 走看看