I have a Java Date object containing date and time information. I want to write a method that cuts off the time information, truncates the hours-minutes-seconds, so I only have the date left.
Example input:
2008-01-01 13:15:00
Expected output:
2008-01-01 00:00:00
Do you have a tip? I tried doing something like this:
(timestamp / (24 * 60 * 60 * 1000)) * (24 * 60 * 60 * 1000)
but I ran into problems with the timezone.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…