i have a form where user enters an ad start time and an ad end time, the format of that time is “yyyy/mm/dd hh:mm:ss”, then this data is push to a database.
BUT when user enters “yyyy/mm/dd 12:00:00” or basically anything 12, when i use 24 it just doesnt work, the database shows 00:00:00 for when i enter 12. how do i prevent that from happening?
SplashPageValue value = new SplashPageValue();
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
value.adStartDate = df.parse(fileUp.getString("adStartDate"));
value.adEndDate = df.parse(fileUp.getString("adEndDate"));
screenshots below:
the form

what i see in database using SQuirreL

Your question is unclear, but I strongly suspect the problem is just that you’re parsing using the 12-hour clock. Change your format string to use HH instead of hh, and that may well just fix things:
You should also consider which time zone you want to use when parsing, mind you. Personally I prefer to use Joda Time for all date and time operations in Java – including for parsing/formatting, as
SimpleDateFormatisn’t thread-safe, unlike Joda Time’s parsers.