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!

using 2400 as the end of the day

user474583Mar 21 2013 — edited Apr 1 2013
Hello,

I've seen a number of posts around military time and whether or not 2400 is a valid time and suggestions on how to properly handle it, but I couldn't really find a post or direction that related directly to the situation I have. I have some users and they would like to use 2400 for time but are expecting that 2400 represents the end of the day and not the beginning of the day. When they see March 21, 24:00 they think of that as March 21, 23:59:59 and not March 21, 00:00:01. I can use the date format kkmm to parse 2400 as a valid time, so they can enter it and it will be saved to the database. The problem I'm having is that when it gets saved to the database 2400 still ends up being 0000 as the time, which is the beginning of the day. Is it possible to easily save 2400 for time in a date or timestamp field in the database and have it represent the end of day or would I need to do something like the following

1) not allow 2400 and say that 2359 is what should be used to represent end of day
2) or change to save the date as a varchar or number field and then have to change it to 2359 if I create a date object in the java code and want to do date arithmetic or comparisons.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2013
Added on Mar 21 2013
10 comments
2,837 views