-Dman100-
asked on
compare datetime
I need to do a datetime comparison that takes a string argument such as 9:00 AM and compares it to the current datetime on the server.
So, if I wanted to compare 3/20/2012 9:00 AM > 3/20/2010 1:00PM it should be false because 9:00 AM is less than 1:00 PM.
One other issue is the time on the server is GMT and I need to translate that time into Mountain time (Phoenix, Arizona).
I'm posting in the java forum, but I'm writing this code in Apex (Salesforce language), which is a derivative of the Java language and is compiled on a Java App Server. One issue is Apex does not have the Java class library available, so I have to write this from scratch.
Any help is appreciated.
Thank you.
So, if I wanted to compare 3/20/2012 9:00 AM > 3/20/2010 1:00PM it should be false because 9:00 AM is less than 1:00 PM.
One other issue is the time on the server is GMT and I need to translate that time into Mountain time (Phoenix, Arizona).
I'm posting in the java forum, but I'm writing this code in Apex (Salesforce language), which is a derivative of the Java language and is compiled on a Java App Server. One issue is Apex does not have the Java class library available, so I have to write this from scratch.
Any help is appreciated.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Java has a lot of functionality associated with dates - if none of it is avaialable in Apex, it is not clear how you can do it
Datetime dt = DateTime.parse('3/20/2012 9:00 AM');