简体   繁体   中英

date format and converting that date to JodaTime

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?

Try

DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMddHHmmss");
DateTime dateTime = formatter.parseDateTime(String.valueOf(start_date));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM