cocos2d-x lua日期获取

cocos2d-x技术群新群:117871561

-- txt_time_ymd日期(Text)  txt_time_hms 时间 (Text) ViewLayer 显示层对象 
function MyCache.setDate(txt_time_ymd,txt_time_hms,ViewLayer)
    local timerNode = cc.Node:create()
    :addTo(ViewLayer)
  txt_time_ymd:setString(os.date("%Y-%m-%d",os.time()))
  txt_time_hms:setString(os.date("%H-%M-%S",os.time()))
  timerNode:runAction(cc.RepeatForever:create( 
                        cc.Sequence:create(
                        cc.DelayTime:create(1),
                        cc.CallFunc:create(function()
                          txt_time_hms:setString(os.date("%H-%M-%S",os.time())) 
                      end)
                  )))
end

你可能感兴趣的:(cocos2d-x lua日期获取)