Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Bug Reports
 PowerHome Messageboard : PowerHome Bug Reports
Subject Topic: ph_getsuntime vs. [SUNSET] etc. Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
patc
Groupie
Groupie


Joined: December 02 2002
Location: United States
Online Status: Offline
Posts: 48
Posted: March 17 2003 at 13:46 | IP Logged Quote patc

I'm not sure if this is a bug or I'm not clear how things work. I wrote a macro to create timed events based on SUNRISE, SUNSET etc. For the current days events the System Variables are OK but for future events I need a calculation. ph_getsuntime() looks like the macro of choice. The results however seemed a little off so I compared them with the System Variables.

Here's my calculations:

ph_getsuntime(date(string(today(),mm-dd-yyyy)),2) = 16:41:37

[SUNSET]  = 18:25:02

where: today() evaluates to: 3/17/2003 13:29:55

I thought the results would be the same. What am I missing?



__________________
PatC
Back to Top View patc's Profile Search for other posts by patc
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 17 2003 at 14:38 | IP Logged Quote dhoward

Patrick,

I don't know if I would call it a bug or a shortcoming of the manual .

In your first example, if you change the part "date(string" to "datetime(string" then you should get back the proper answer.  The function is expecting a datetime variable instead of a date.  Since this is the case, you can simplify your function by just calling: ph_getsuntime(today(),2).

If you are trying to calculate dates in the future, you can also use: ph_getsuntime(relativedate(today(),3),2) to calculate 3 days from the current day.  The today function will either return a date or a datetime depending upon the context, so it will work in the above situations.

HTH,

Dave.

 

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


Joined: December 02 2002
Location: United States
Online Status: Offline
Posts: 48
Posted: March 17 2003 at 16:03 | IP Logged Quote patc

Thanks Dave. I'll try it. My macro really wants the actual future date but I guess I can convert the date to days ahead to use relativedate()

Pat



__________________
PatC
Back to Top View patc's Profile Search for other posts by patc
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 17 2003 at 16:10 | IP Logged Quote dhoward

Pat,

If you know the actual date, then you can code it like in the example below:

ph_getsuntime(2003-03-17 00:00:00,2).

You can also use relativedate with an actual date (or rather datetime):

ph_getsuntime(relativedate(2003-03-17 00:00:00,5),2).

HTH,

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward'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