日期格式,并将该日期转换为JodaTime [英] date format and converting that date to JodaTime

查看:311
本文介绍了日期格式,并将该日期转换为JodaTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用日期作为参数与url调用以下格式
YYYYMMDDHHMMSS.When我检查了java日期它是如何在java中这样做?或者我必须使用以下代码手动给予时间?

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;

上面的变量有一个从2014年04月04日23日和时间小时:10的日期min,10和sec:10。
我希望这个时间以上面的格式(YYYYMMDDHHMMSS)到JodaTime。

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.

有可能吗?

推荐答案

尝试

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

这篇关于日期格式,并将该日期转换为JodaTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆