问题
I want to use date as a parameter with a url call in the following format YYYYMMDDHHMMSS.When i checked java Date it is in how can i do that in java ? or i have to give time manually using the below code?
public static long start_date=20140423101010L;
the above variable has a date from the year 2014 month 04, date 23, and time hour :10., min:10 and sec :10. I want this time in the above format (YYYYMMDDHHMMSS) to JodaTime.
Is it possible to do that?
回答1:
Try
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMddHHmmss");
DateTime dateTime = formatter.parseDateTime(String.valueOf(start_date));
来源:https://stackoverflow.com/questions/24324149/date-format-and-converting-that-date-to-jodatime