新的Date()到java中的Julian日期格式 [英] new Date() to Julian date format in java
问题描述
我需要将新的Date()转换为Julian日期格式。
我的确切要求是
I need to convert new Date() to Julian date format.is there is any build in java function for this. my exact requirement is
以朱利安日期格式(0YYDDD)表示文件的创建日期:0 - 数字零YY - 年份的最后两位数DDD - 一年内的日数可以在传输日期之前的最多7个日历日例如:010163 = 2010年6月11日
Represents the creation date of the file in Julian date format (0YYDDD): 0 – numeric zero YY – last two digits of the year DDD – day number within the year Can be up to 7 calendar days before the date of transmission Example: 010163 = June 11, 2010
真正看起来是一些事情这个
What is really looking is some thing like this
Date date=new Date();
String JulianDtae=date.someFunction()
任何帮助将不胜感激
推荐答案
使用 SimpleDateFormat 。
以下代码返回 date $ c的Julian日期字符串$ c>根据你给的格式。
The following code returns the Julian date string for date
according to the format you gave.
String julianDateString = new SimpleDateFormat("'0'yyD").format(date);
这篇关于新的Date()到java中的Julian日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!