Hello All,
I'm quite new to connect iq & monkey c and have faced now an issue with Gregorian.Moment. Hope this is correct forum to ask.. I'm trying to create new moment with given values. For some reason minute value stays always as zero even if value entered. Would be highly appreciated if someone could give a hint what I've missed..
I have stored time value in storage as array in format "23:45". Then trying to create moment for today based on that time. Everything else works but not minutes - even if entered manually as number value. Substring also seems to return correct value, "45" in this case. I assume there is something wrong with the code below but I can't figure that out..
var medTime = Application.Storage.getValue("alertTime");
var now8 = Time.now();
var kello = Gregorian.info(now8, Time.FORMAT_SHORT);
kpl4=Application.Storage.getValue("kpl");
for (var i = 0; i < kpl4; i++) {
var medTime2 = medTime[i].toString();
System.println(medTime2);
var options = {
:year => kello.year,
:month => kello.month,
:day => kello.day,
:hour => medTime2.substring(0,2).toNumber(),
:min => medTime2.substring(4,5).toNumber()
};
var alertAika = Gregorian.moment(options);
var utcAika = Gregorian.utcInfo(alertAika, Time.FORMAT_SHORT);
System.println("AlertAika: "+utcAika.day+"."+utcAika.month+"."+utcAika.year+" "+utcAika.hour+":"+utcAika.min.format("%02d"));
Many thanks in advance !
-sami