Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Convert date in BST to GMT format

807580Oct 5 2009 — edited Oct 5 2009
Here date and cal.getTime() return date in BST format. But my requirement is date should be converted to GMT format and then compared with cal.getTime() which is in BST format.
          Object o = timeStamp.get(TIMESTAMP_OBJECT);
            java.util.Date date = (java.util.Date) o;
            
                      
            Calendar cal = Calendar.getInstance();
            getBDO().setLastDespatch(isLastDespatch(cal.getTime(), date));
     
........
 public static boolean isLastDespatch(Date counterDate, Date lastDespatchDate)
    {
        if (counterDate.before(lastDespatchDate))
        {
            // last despatch timestamp before
            return false;
        }
        else
        {
            // last despatch timestamp expired, therefore tell clerk
            return true;
        }
    }
I tried
 
Object g = date.toGMTString();
 
But I am not able to convert this object to again Date...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 2 2009
Added on Oct 5 2009
5 comments
1,736 views