473,320 Members | 2,041 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Extract time from Calendar Object

I just want to extract the time component of the calendar object for comparison to another. Is this possible?

here's my code:
Expand|Select|Wrap|Line Numbers
  1. try {
  2.     String str_date="2009-10-15 12:1:00";
  3.     DateFormat formatter =
  4.         new SimpleDateFormat("yyyy-MM-dd k:mm:ss");
  5.     Date date = (Date)formatter.parse(str_date); 
  6.     Calendar cal = Calendar.getInstance();
  7.     cal.setTime(date);
  8.     System.out.println("Today is " +date );
  9.  
  10.     //need to do something here to get just the time field
  11.     //for comparing. Just the hours, minutes and seconds.
  12.     //I want to do something like
  13.     //if (cal.getTime() > someTimeObject )
  14.     // do something here
  15. } catch (java.text.ParseException e) { e.printStackTrace(); }   
  16.  
thanks!

kind regards.
JR
Oct 17 '09 #1
1 2991
bumping this question.. anyone want to answer this? T_T
Oct 17 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rob | last post by:
Why is this not returning the right day or month? It gives me 5 when the rightnow variable gives a 18. import java.util.Calendar; public class Test { public static void main(String args) {...
1
by: Don | last post by:
I have a form that uses an Image object to open a report (the report is based on a query). I used the image object because the MS command buttons are dull looking. All of this works well. The...
10
by: KevinL | last post by:
I'm writing a random number generator program and using time() to seed it. I found out that time() output is in seconds. Do you know of another function that outputs in thousands of seconds ? ...
0
by: maxrawson | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
19
by: Melvin G. Sheppers | last post by:
I want to display the time in a particular timezone (US Central) regardless where the computer is located. I have written the script below which displays the time in the Eastern, Central, Mountain,...
1
by: dangier | last post by:
I have an Access 2003 table with an XML field that is tagged as follows: <Calendar CompactMode="1"><CustomProperties><CustomProperty Name="startdate" Value="3/26/2007"...
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
3
by: panos100m | last post by:
Relevant part of the code:: //that code wouldnt work ..its purpose is to compare the current time with a give time (in this case italian) //output of current time is displayed as 0001 ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.