NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to get begin and end of a date

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
HASSAN Kamrul
Posted via mailing list.





PostPosted: Tue Dec 23, 2008 5:05 pm    Post subject: How to get begin and end of a date Reply with quote

I have a Calendar control after selecting a date from icon
it displays as "12/23/2008" and prints as "Tues Dec 23 00:00:00 CST
2008"
Could you tell me how can I print "Tues Dec 23 11:59:59 CST 2008" as
well,

I need to get epoch time for both begin & end of a date.

Thanks
kam
Back to top
Melongo Annabel
Posted via mailing list.





PostPosted: Tue Dec 23, 2008 7:08 pm    Post subject: How to get begin and end of a date Reply with quote

I really don't understand your question. Can you be more explicit, please?


From: HASSAN Kamrul <address-removed>
To: address-removed
Sent: Tuesday, December 23, 2008 11:05:21 AM
Subject: [nbj2ee] How to get begin and end of a date

I have a Calendar control after selecting a date from icon
it displays as "12/23/2008" and prints as "Tues Dec 23 00:00:00 CST
2008"
Could you tell me how can I print "Tues Dec 23 11:59:59 CST 2008" as
well,

I need to get epoch time for both begin & end of a date.

Thanks
kam
Back to top
HASSAN Kamrul
Posted via mailing list.





PostPosted: Tue Dec 23, 2008 7:25 pm    Post subject: How to get begin and end of a date Reply with quote

Thank you for quick response.

When I do followings I get [start of day] "Tue Dec 23 00:00:00 CST 2008" [I think it is default date and time format]

System.out.printf("\nStart date : " + calendar1.getSelectedDate() + "\n");

I need to send [end of day] "Tue Dec 23 11:59:59 CST 2008" to Oracle DB query [start & end of day in Epoch]

Thanks
kam

From: Melongo Annabel [mailto:address-removed]
Sent: Tuesday, December 23, 2008 1:08 PM
To: address-removed
Subject: Re: [nbj2ee] How to get begin and end of a date



I really don't understand your question. Can you be more explicit, please?


From: HASSAN Kamrul <address-removed>
To: address-removed
Sent: Tuesday, December 23, 2008 11:05:21 AM
Subject: [nbj2ee] How to get begin and end of a date

I have a Calendar control after selecting a date from icon
it displays as "12/23/2008" and prints as "Tue Dec 23 00:00:00 CST
2008"
Could you tell me how can I print "Tue Dec 23 11:59:59 CST 2008" as
well,

I need to get epoch time for both begin & end of a date.

Thanks
kam
Back to top
Wade Chandler
Posted via mailing list.





PostPosted: Tue Dec 23, 2008 7:45 pm    Post subject: How to get begin and end of a date Reply with quote

Use the SimpleDateFormat class which I have sent you code before Kam. You can use it to transform dates.

Wade

==================
Wade Chandler, CCE
Software Engineer and Developer, Certified Forensic Computer Examiner, NetBeans Dream Team Member, and NetBeans Board Member
http://www.certified-computer-examiner.com
http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam
http://www.netbeans.org


From: HASSAN Kamrul <address-removed>
To: address-removed
Sent: Tuesday, December 23, 2008 2:25:16 PM
Subject: [nbj2ee] How to get begin and end of a date

DIV { MARGIN:0px;} Thank you for quick response.

When I do followings I get [start of day] "Tue Dec 23 00:00:00 CST 2008" [I think it is default date and time format]

System.out.printf("\nStart date : " + calendar1.getSelectedDate() + "\n");

I need to send [end of day] "Tue Dec 23 11:59:59 CST 2008" to Oracle DB query [start & end of day in Epoch]

Thanks
kam

From: Melongo Annabel [mailto:address-removed]
Sent: Tuesday, December 23, 2008 1:08 PM
To: address-removed
Subject: Re: [nbj2ee] How to get begin and end of a date



I really don't understand your question. Can you be more explicit, please?


From: HASSAN Kamrul <address-removed>
To: address-removed
Sent: Tuesday, December 23, 2008 11:05:21 AM
Subject: [nbj2ee] How to get begin and end of a date

I have a Calendar control after selecting a date from icon
it displays as "12/23/2008" and prints as "Tue Dec 23 00:00:00 CST
2008"
Could you tell me how can I print "Tue Dec 23 11:59:59 CST 2008" as
well,

I need to get epoch time for both begin & end of a date.

Thanks
kam
Back to top
Melongo Annabel
Posted via mailing list.





PostPosted: Tue Dec 23, 2008 7:50 pm    Post subject: How to get begin and end of a date Reply with quote

What you need to do is to create an instance of Calendar and you set the year, the month, the day of month, the hour, the minutes and the seconds on that instance and then use to System.out.printf . Here's an example:

Calendar endOfDay = Calendar.getInstance();
endOfDay.set(2008,12,23,11,59,59);
System.out.printf("\nEnd date: " + endOfDay + "\n");

Hope this helps.


From: HASSAN Kamrul <address-removed>
To: address-removed
Sent: Tuesday, December 23, 2008 1:25:16 PM
Subject: [nbj2ee] How to get begin and end of a date

DIV { MARGIN:0px;} Thank you for quick response.

When I do followings I get [start of day] "Tue Dec 23 00:00:00 CST 2008" [I think it is default date and time format]

System.out.printf("\nStart date : " + calendar1.getSelectedDate() + "\n");

I need to send [end of day] "Tue Dec 23 11:59:59 CST 2008" to Oracle DB query [start & end of day in Epoch]

Thanks
kam

From: Melongo Annabel [mailto:address-removed]
Sent: Tuesday, December 23, 2008 1:08 PM
To: address-removed
Subject: Re: [nbj2ee] How to get begin and end of a date



I really don't understand your question. Can you be more explicit, please?


From: HASSAN Kamrul <address-removed>
To: address-removed
Sent: Tuesday, December 23, 2008 11:05:21 AM
Subject: [nbj2ee] How to get begin and end of a date

I have a Calendar control after selecting a date from icon
it displays as "12/23/2008" and prints as "Tue Dec 23 00:00:00 CST
2008"
Could you tell me how can I print "Tue Dec 23 11:59:59 CST 2008" as
well,

I need to get epoch time for both begin & end of a date.

Thanks
kam
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo