edit:
i didn't noticed that you have done with removing 0 from it,
so have this one as another way;
==================
and some tips:
i forgot to tell, you can also use [accweathercore] for update instead of [datetimecore];
(to lower the resource usage)
==================
just added this line to previous code, this will convert the string to integer:
Code:
tmp1[0]=parseInt(tmp1[0],10)
here's the full code:
Code:
function datetimecore1OnUpdate(Sender)
{
//sunrise
tmp1=accweathercore1.get("%sunRise").split(":")
tmp1[0]= parseInt(tmp1[0],10)
if(tmp1[0]>12)
{
tmp1[0]=tmp1[0]-12
sunrise.Text="Sunrise: "+tmp1[0]+":"+tmp1[1]+" PM"
}
else if(tmp1[0]==0)
{
sunrise.Text="Sunrise: "+12+":"+tmp1[1]+" AM"
}
else if(tmp1[0]==12)
{
sunrise.Text="Sunrise: "+12+":"+tmp1[1]+" PM"
}
else if(tmp1[0]<12)
{
sunrise.Text="Sunrise: "+tmp1[0]+":"+tmp1[1]+" AM"
}
//sunset
tmp1=accweathercore1.get("%sunSet").split(":")
tmp1[0]=parseInt(tmp1[0],10)
if(tmp1[0]>12)
{
tmp1[0]=tmp1[0]-12
sunset.Text="Sunset: "+tmp1[0]+":"+tmp1[1]+" PM"
}
else if(tmp1[0]==0)
{
sunset.Text="Sunset: "+12+":"+tmp1[1]+" AM"
}
else if(tmp1[0]==12)
{
sunset.Text="Sunset: "+12+":"+tmp1[1]+" PM"
}
else if(tmp1[0]<12)
{
sunset.Text="Sunset: "+tmp1[0]+":"+tmp1[1]+" AM"
}
}