Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Question on datetime function Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
scottmi1
Groupie
Groupie
Avatar

Joined: July 11 2006
Location: United States
Online Status: Offline
Posts: 60
Posted: March 06 2009 at 13:09 | IP Logged Quote scottmi1

Having a problem getting the datetime function to work in my macro.

This formula works:
date(ph_regexdiff("<date>","</date>","[LOCAL1]",1,0))
Source value is "03/06/09" and returned value is "03/06/2009"

And this formula works:
time(ph_regexdiff("<time>","</time>","[LOCAL1]",1,0))
Source value is "12:10 PM" and returned value is "12:50:00"

But this formula doesn't (it evaluates to !):
datetime(ph_regexdiff("<date>","</date>","[LOCAL1]",1,0),ph_regexdiff("<time>","</time>","[LOCAL1]",1,0))

So I tried this and it doesn't work either:
datetime("03/06/09","12:10 PM")

Any ideas what I'm doing wrong?

Mike..
Back to Top View scottmi1's Profile Search for other posts by scottmi1
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 06 2009 at 13:39 | IP Logged Quote BeachBum

Try separating the 2 with a + instead of a ,

datetime(ph_regexdiff("<date>","</date>","[LOCAL1]",1,0) + ph_regexdiff("<time>","</time>","[LOCAL1]",1,0))


Edited by BeachBum - March 06 2009 at 13:41


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
jbbtex
Senior Member
Senior Member


Joined: February 15 2007
Location: United States
Online Status: Offline
Posts: 181
Posted: March 06 2009 at 13:42 | IP Logged Quote jbbtex

try it like this:

datetime("03/06/09, 12:10pm")

__________________
Brady

"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity." - Gen. George S. Patton
Back to Top View jbbtex's Profile Search for other posts by jbbtex
 
scottmi1
Groupie
Groupie
Avatar

Joined: July 11 2006
Location: United States
Online Status: Offline
Posts: 60
Posted: March 06 2009 at 14:05 | IP Logged Quote scottmi1

Brady - your correction worked and gave me the clue I needed to fix my original formula.

Pete - I replaced the comma with a "+" and while I didn't get an error, the returned value was blank. I then figured out I needed both. Here's the formula that works:

datetime(ph_regexdiff("<date>","</date>","[LOCAL1]",1,0) + "," + ph_regexdiff("<time>","</time>","[LOCAL1]",1,0))

Thanks for the quick replies!

Mike..
Back to Top View scottmi1's Profile Search for other posts by scottmi1
 

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