Author |
|
veropierre Groupie
Joined: May 06 2009 Location: United States
Online Status: Offline Posts: 47
|
Posted: June 01 2009 at 10:11 | IP Logged
|
|
|
I'm struggling with numbers and time / date formatting...
Date how can I change 09:01:45:812 to 09:01:45? I tried few things but still get the infamous "!"
Numbers how can I change 0.7581 to 0.76? I didn't try anything yest - too scared of the infamous "!"
Thank you!
Edited by veropierre - June 01 2009 at 13:04
__________________ 37 Insteon Switches + 14 Lamp Modules + 7 ControLinc + 2 RemoteLinc + 3 Insteon Thermostats + 8 Zones Sprinklers + several X10 + Power Home 2.1.4 = Happy Camper
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: June 01 2009 at 12:40 | IP Logged
|
|
|
For the second case try truncate(). It does not round but does truncate to the desired number of decimal places. If you round yourself before doing the truncate you get the desired result.
truncate(0.7581 , 2) result is 0.75
truncate(0.7581+0.0050 , 2) result is 0.76
truncate(0.7531+0.0050 , 2) result is 0.75
__________________ Lee G
|
Back to Top |
|
|
veropierre Groupie
Joined: May 06 2009 Location: United States
Online Status: Offline Posts: 47
|
Posted: June 01 2009 at 13:03 | IP Logged
|
|
|
Thanks Lee... truncate() it is, I'm not worried about the +/- 1% :)
Any idea about the date one?
__________________ 37 Insteon Switches + 14 Lamp Modules + 7 ControLinc + 2 RemoteLinc + 3 Insteon Thermostats + 8 Zones Sprinklers + several X10 + Power Home 2.1.4 = Happy Camper
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: June 01 2009 at 13:10 | IP Logged
|
|
|
What is the source of the time value you want to remove the milliseconds from?
__________________ Lee G
|
Back to Top |
|
|
veropierre Groupie
Joined: May 06 2009 Location: United States
Online Status: Offline Posts: 47
|
Posted: June 01 2009 at 13:15 | IP Logged
|
|
|
now() is the one - I couldn't find other alternatives... ha newbies
Edited by veropierre - June 01 2009 at 13:15
__________________ 37 Insteon Switches + 14 Lamp Modules + 7 ControLinc + 2 RemoteLinc + 3 Insteon Thermostats + 8 Zones Sprinklers + several X10 + Power Home 2.1.4 = Happy Camper
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: June 01 2009 at 13:22 | IP Logged
|
|
|
Try time(string(now())) it returns hh:mm:ss
__________________ Lee G
|
Back to Top |
|
|
veropierre Groupie
Joined: May 06 2009 Location: United States
Online Status: Offline Posts: 47
|
Posted: June 01 2009 at 14:02 | IP Logged
|
|
|
Will do thank you!
__________________ 37 Insteon Switches + 14 Lamp Modules + 7 ControLinc + 2 RemoteLinc + 3 Insteon Thermostats + 8 Zones Sprinklers + several X10 + Power Home 2.1.4 = Happy Camper
|
Back to Top |
|
|