uniclau / AlarmPlugin

Cordova plugin to wake up Android devices
16 stars 14 forks source link

format for date and time #2

Open hmdadou opened 9 years ago

hmdadou commented 9 years ago

I would like to test this plugin could you tell me what is the format of alarmDate please.,

jbaylina commented 9 years ago

It is a long. (Seconds since 1970-1-1.

See AlarmManager.set El dia 10/04/2015 11.59, "Mohamed" notifications@github.com va escriure:

I would like to test this plugin could you tell me what is the format of alarmDate please.,

— Reply to this email directly or view it on GitHub https://github.com/uniclau/AlarmPlugin/issues/2.

hmdadou commented 9 years ago

Thanks for your reply but unfortunately I couldn't understand what you meant by It is a long. (Seconds since 1970-1-1.

if I wanted to set the time and date for the alarm to start on this date what would be the format. example* 11/04/2015 10:30am*

much appreciated thanks

HM Dadou

On 10 April 2015 at 16:33, Jordi Baylina notifications@github.com wrote:

It is a long. (Seconds since 1970-1-1.

See AlarmManager.set El dia 10/04/2015 11.59, "Mohamed" notifications@github.com va escriure:

I would like to test this plugin could you tell me what is the format of alarmDate please.,

— Reply to this email directly or view it on GitHub https://github.com/uniclau/AlarmPlugin/issues/2.

— Reply to this email directly or view it on GitHub https://github.com/uniclau/AlarmPlugin/issues/2#issuecomment-91593875.

Best regards HM Dadou

manvick commented 9 years ago

Datetime format is converted to seconds after 1970-1-1 Use any Date/Epoch Converter to convert your date time to the specified format.

But i still cant get this working. :(

ehsand commented 9 years ago

you can simply change the time format in AlarmPlugin.java ex: change
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); Date aDate = sdf.parse(args.getString(0).replace("Z", "+0000")); to SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); Date aDate = sdf.parse(args.getString(0));

rashnk commented 8 years ago

@ehsand , if i change the code as u mentioned above navigator.plugins.alarm.set("2016-04-08 18:00", function(){ // SUCCESS }, function(){ // ERROR })

is this correct ?