Is it possible to generate a random datetime using Jodatime such that the datetime has the format yyyy-MM-dd HH:MM:SS and it should be able to generate two random datetimes
Simple
long rangebegin = Timestamp.valueOf("2013-02-08 00:00:00").getTime(); long rangeend = Timestamp.valueOf("2013-02-08 00:58:00").getTime(); long diff = rangeend - rangebegin + 1; Timestamp rand = new Timestamp(rangebegin + (long)(Math.random() * diff));