Image

Imagejojobear99 wrote in Imagejava_dev

Date object for sunday of current week?

How would I get Sunday at midnight of the current week (we can assume UTC) into a java.util.Date object? It looks like I probably need to make a GregorianCalendar object and convert that into the Date object using getTime()--but I can't figure out what I need to do to figure out which constructor to use and what parameters I need to set in the GregorianCalendar. That and I couldn't find any functions for doing math on a time, because what I'm trying to do is convert a timestamp that is merely seconds into the current week into a proper timestamp relative to "the beginning of time" so that it prints out as 2005 and all that good stuff. Any pointers in the right direction would be much appreciated