Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Numbers formatting question Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
veropierre
Groupie
Groupie
Avatar

Joined: May 06 2009
Location: United States
Online Status: Offline
Posts: 47
Posted: June 01 2009 at 10:11 | IP Logged Quote veropierre

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 View veropierre's Profile Search for other posts by veropierre Visit veropierre's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: June 01 2009 at 12:40 | IP Logged Quote grif091

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 View grif091's Profile Search for other posts by grif091
 
veropierre
Groupie
Groupie
Avatar

Joined: May 06 2009
Location: United States
Online Status: Offline
Posts: 47
Posted: June 01 2009 at 13:03 | IP Logged Quote veropierre

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 View veropierre's Profile Search for other posts by veropierre Visit veropierre's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: June 01 2009 at 13:10 | IP Logged Quote grif091

What is the source of the time value you want to remove the milliseconds from?

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
veropierre
Groupie
Groupie
Avatar

Joined: May 06 2009
Location: United States
Online Status: Offline
Posts: 47
Posted: June 01 2009 at 13:15 | IP Logged Quote veropierre

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 View veropierre's Profile Search for other posts by veropierre Visit veropierre's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: June 01 2009 at 13:22 | IP Logged Quote grif091

Try   time(string(now()))   it returns hh:mm:ss

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
veropierre
Groupie
Groupie
Avatar

Joined: May 06 2009
Location: United States
Online Status: Offline
Posts: 47
Posted: June 01 2009 at 14:02 | IP Logged Quote veropierre

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 View veropierre's Profile Search for other posts by veropierre Visit veropierre's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum