I’m doing a java program that will take an action based on the date and time.
the problem is that when I used the java.util.Date object i found that it is affected by the windows wall clock, i don’t know what to do, I’m needing to the date to be never affected by anything, or if any one know how to take this action in another way
thank you very much
I’m doing a java program that will take an action based on the date
Share
If you want a specific Date and Time you need to create an instance of
Datewith the date and time instance information you want instead of callingnew Date()which will give you thecurrentinstance in time. Use theGregorianCalendaror some otherCalendarsub-class.If you want only the
Dateto be relevant you need to ZERO out the time ( hours, minutes, seconds, milliseconds ) off your Date object.then on your
Dateinstance ofdatedo.setTime(date, 0, 0, 0, 0);