Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Subtracting Time Values Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 14 2009 at 04:30 | IP Logged Quote mike0999

Hi,

I am new to Powerhome - trying it out during my 30 day trial period. Seems like a great program. Amazing flexibility.

I am trying to create a formula that gives me the time 30 minutes in the future. The relativetime function returns a maximum value of 23:59:59. So, if I use the relativetime command for any time that is 23:30:00 or greater, I get an error.

I have been trying to work my way around this by using an if statement to test if I am later than 23:29:59. I have been trying to use the if statement to subtract 23:30:00 from the now() time if I am later than 23:29:59, but I get an error whenever I try to subtract time values.

Does subtraction not work with time values or am I doing something wrong?

I am sure I can come up with an approach that works, but wanted to ask to confirm whether or not subtraction is supposed to work with time values.

Thanks in advance for any help.

Regards,

Mike
Back to Top View mike0999's Profile Search for other posts by mike0999
 
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 14 2009 at 06:36 | IP Logged Quote mike0999

I think this probably does what I want:

if(now() > 23:29:59,relativetime(00:00:00,secondsafter(23:30:00,now())) ,relativetime(now(),1800))

But, still would like to confirm you can't "subtract" times (maybe unless you convert to seconds first)?
Back to Top View mike0999's Profile Search for other posts by mike0999
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 15 2009 at 22:04 | IP Logged Quote dhoward

Mike,

Welcome to PowerHome!

Unfortunately, you cant directly add/subtract Time values. You must use one of the relativetime type of functions. However, to obtain a simple time 30 minutes in the future, just use this formula:

Code:
time(ph_relativedatetime(today(),30))


It won't have the problems of going beyond the current day.

HTH,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 15 2009 at 22:47 | IP Logged Quote mike0999

Hey Dave. Thanks a lot!
Back to Top View mike0999's Profile Search for other posts by mike0999
 

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