File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Mongo DB Applied Patterns
this week in the
or a resume review from
Five Year Itch
HowTo use DateFormat static field constants ?
Joined: Apr 16, 2004
Nov 30, 2008 10:32:00
How are the static fields of
)such as DAY_OF_YEAR intended to be used (example please)? Could I use it to build a Julian date ?
public static final int DAY_OF_YEAR_FIELD Useful constant for DAY_OF_YEAR field alignment. Used in FieldPosition of date/time formatting.
Joined: May 27, 2008
Nov 30, 2008 15:49:00
DAY_OF_YEAR_FIELD, etc., can be used to return the position at which a data field was formatted. DAY_OF_YEAR_FIELD is
's %D, which is not very common. For YEAR_FIELD:
DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL); FieldPosition posn = new FieldPosition(DateFormat.YEAR_FIELD); StringBuffer sb = new StringBuffer(); fmt.format(new Date(), sb, posn); sb.replace(posn.getBeginIndex(), posn.getEndIndex(), "xxxx"); System.out.println(sb);
It doesn't look like this will help with Julian dates.
I agree. Here's the link:
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: HowTo use DateFormat static field constants ?
How to get tomorrow's date?
How to derive YYYYMMDD from DAY_IN_YEAR?
Date Converting String to Date
datefiled in dd-mm-yyyy format
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013