0

コロナ アプリでユーザーが設定した特定の時間にローカル通知を設定しようとしています。次のガイドを使用して、基本的な通知が機能しています。 http://developer.coronalabs.com/reference/index/systemschedulenotification

local utcTime = os.date( "!*t", os.time() + 60 )
local notification = system.scheduleNotification( utcTime, options )

しかし、私はユーザーが選択した時間を取得し、上記のコードの os.time() + 60 の部分を置き換えるために、coordinatedUniversalTime 形式で日付テーブルを作成したいと考えています。誰もそれを行う方法を知っていますか?

私のタイム ピッカーは、基本的な時間と分の値を返します。それが AM または PM の場合です。

ありがとう!

4

1 に答える 1

0

わかりました、簡単でした。

local options = {
           alert = "Alert Text",
           sound = "audio/sound.caf"
        }

        local currentDate = os.date( "*t" )
        local notificationHr
        if reminderPicker1.getAMPM() == "am" then
            notificationHr = reminderPicker1.getHour()
        else
            notificationHr = reminderPicker1.getHour() + 12
        end
        local utcTime = os.date( "!*t", os.time{year=currentDate.year, month=currentDate.month, day=currentDate.day, hour=notificationHr, min=reminderPicker1.getMin(), sec=0 } )
        local notification = system.scheduleNotification( utcTime, options )
于 2012-07-21T18:32:49.703 に答える