|
KosherJava Zmanim Homepage Includes a dynamic Zmanim calendar generator |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.zmanim.util.ZmanimFormatter
public class ZmanimFormatter
A class used to format non Date times generated by the
Zmanim package. For example the
AstronomicalCalendar.getTemporalHour() returns
the length of the hour in milliseconds. This class can format this time.
| Field Summary | |
|---|---|
static int |
DECIMAL_FORMAT
Format using standard decimal format with 5 positions after the decimal. |
(package private) static long |
HOUR_MILLIS
constant for milliseconds in an hour (3,600,000) |
(package private) static long |
MINUTE_MILLIS
constant for milliseconds in a minute (60,000) |
static int |
SEXAGESIMAL_FORMAT
Format using hours and minutes. |
static int |
SEXAGESIMAL_MILLIS_FORMAT
Format using hours, minutes, seconds and milliseconds. |
static int |
SEXAGESIMAL_SECONDS_FORMAT
Format using hours, minutes and seconds. |
static int |
SEXAGESIMAL_XSD_FORMAT
Format using hours, minutes, seconds and milliseconds using the xsd:time format. |
(package private) boolean |
useDecimal
|
static int |
XSD_DURATION_FORMAT
Format using the XSD Duration format. |
| Constructor Summary | |
|---|---|
ZmanimFormatter()
|
|
ZmanimFormatter(int format,
SimpleDateFormat dateFormat)
ZmanimFormatter constructor using a formatter |
|
| Method Summary | |
|---|---|
String |
format(double milliseconds)
A method that formats milliseconds into a time format. |
String |
format(int millis)
A method that formats milliseconds into a time format. |
String |
format(Time time)
A method that formats Timeobjects. |
String |
formatDateTime(Date dateTime,
Calendar calendar)
Formats a date using this classe's date format. |
String |
formatXSDDurationTime(long millis)
This returns the xml representation of an xsd:duration object. |
String |
formatXSDDurationTime(Time time)
This returns the xml representation of an xsd:duration object. |
SimpleDateFormat |
getDateFormat()
|
String |
getXSDateTime(Date dateTime,
Calendar cal)
The date:date-time function returns the current date and time as a date/time string. |
void |
setDateFormat(SimpleDateFormat sdf)
|
void |
setTimeFormat(int format)
Sets the format to use for formatting. |
static String |
toXML(AstronomicalCalendar ac)
A method that returns an XML formatted String representing
the serialized Object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
boolean useDecimal
public static final int SEXAGESIMAL_XSD_FORMAT
public static final int DECIMAL_FORMAT
public static final int SEXAGESIMAL_FORMAT
public static final int SEXAGESIMAL_SECONDS_FORMAT
public static final int SEXAGESIMAL_MILLIS_FORMAT
static final long MINUTE_MILLIS
static final long HOUR_MILLIS
public static final int XSD_DURATION_FORMAT
| Constructor Detail |
|---|
public ZmanimFormatter()
public ZmanimFormatter(int format,
SimpleDateFormat dateFormat)
format - int The formatting style to use. Using
ZmanimFormatter.SEXAGESIMAL_SECONDS_FORMAT will format the
time time of 90*60*1000 + 1 as 1:30:00| Method Detail |
|---|
public void setTimeFormat(int format)
format - int the format constant to use.public void setDateFormat(SimpleDateFormat sdf)
public SimpleDateFormat getDateFormat()
public String format(double milliseconds)
milliseconds - The time in milliseconds.
Stringpublic String format(int millis)
millis - The time in milliseconds.
Stringpublic String format(Time time)
Timeobjects.
time - The time Object to be formatted.
String
public String formatDateTime(Date dateTime,
Calendar calendar)
date format.
dateTime - the date to formatcalendar - the Calendar used to help format
based on the Calendar's DST and other settings.
public String getXSDateTime(Date dateTime,
Calendar cal)
public String formatXSDDurationTime(long millis)
millis - the duration in milliseconds
public String formatXSDDurationTime(Time time)
time - the duration as a Time object
public static String toXML(AstronomicalCalendar ac)
String representing
the serialized Object. The format used is:
<AstronomicalTimes date="1969-02-08" type="net.sourceforge.zmanim.AstronomicalCalendar algorithm="US Naval Almanac Algorithm" location="Lakewood, NJ" latitude="40.095965" longitude="-74.22213" elevation="31.0" timeZoneName="Eastern Standard Time" timeZoneID="America/New_York" timeZoneOffset="-5">
<Sunrise>2007-02-18T06:45:27-05:00</Sunrise>
<TemporalHour>PT54M17.529S</TemporalHour>
...
</AstronomicalTimes>
Note that the output uses the xsd:dateTime
format for times such as sunrise, and xsd:duration
format for times that are a duration such as the length of a
temporal hour. The output of this method is
returned by the toString }.
String. The format will be:
<AstronomicalTimes date="1969-02-08" type="net.sourceforge.zmanim.AstronomicalCalendar algorithm="US Naval Almanac Algorithm" location="Lakewood, NJ" latitude="40.095965" longitude="-74.22213" elevation="31.0" timeZoneName="Eastern Standard Time" timeZoneID="America/New_York" timeZoneOffset="-5">
<Sunrise>2007-02-18T06:45:27-05:00</Sunrise>
<TemporalHour>PT54M17.529S</TemporalHour>
...
</AstronomicalTimes>
|
KosherJava Zmanim Homepage Includes a dynamic Zmanim calendar generator |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||