|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgsfc.nssdc.cdf.util.Epoch
public class Epoch
Example:
// Get the milliseconds to Aug 5, 1990 at 5:00 double ep = Epoch.compute(1990, 8, 5, 5, 0, 0, 0); //Get the year, month, day, hour, minutes, seconds, milliseconds for ep long times[] = Epoch.breakdown(ep); for (int i=0;i<times.length;i++) System.out.print(times[i]+" "); System.out.println(); // Printout the epoch in various formats System.out.println(Epoch.encode(ep)); System.out.println(Epoch.encode1(ep)); System.out.println(Epoch.encode2(ep)); System.out.println(Epoch.encode3(ep)); System.out.println(Epoch.encode4(ep)); // Print out the date using format String format = ", at : "; System.out.println(Epoch.encodex(ep,format));
Field Summary |
---|
Constructor Summary | |
---|---|
Epoch()
|
Method Summary | |
---|---|
static long[] |
breakdown(double epoch)
Breaks an EPOCH value down into its component parts. |
static double |
compute(long year,
long month,
long day,
long hour,
long minute,
long second,
long msec)
Computes an EPOCH value based on its component parts. |
static java.lang.String |
encode(double epoch)
Converts an EPOCH value into a readable date/time string. |
static java.lang.String |
encode1(double epoch)
Converts an EPOCH value into a readable date/time string. |
static java.lang.String |
encode2(double epoch)
Converts an EPOCH value into a readable date/time string. |
static java.lang.String |
encode3(double epoch)
Converts an EPOCH value into a readable date/time string. |
static java.lang.String |
encode4(double epoch)
Converts an EPOCH value into a readable date/time, ISO8601 string. |
static java.lang.String |
encodex(double epoch,
java.lang.String formatString)
Converts an EPOCH value into a readable date/time string using the specified format. |
static double |
parse(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH value. |
static double |
parse1(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH value. |
static double |
parse2(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH value. |
static double |
parse3(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH value. |
static double |
parse4(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Epoch()
Method Detail |
---|
public static double parse(java.lang.String inString) throws CDFException
Format: dd-mmm-yyyy hh:mm:ss.mmm Examples: 1-Apr-1990 03:05:02.000 10-Oct-1993 23:45:49.999The expected format is the same as that produced by encodeEPOCH.
inString
- the epoch in string representation
CDFException
- if a bad epoch value is passed in inStringpublic static double parse1(java.lang.String inString) throws CDFException
Format: yyyymmdd.ttttttt Examples: 19950508.0000000 19671231.58 (== 19671213.5800000)The expected format is the same as that produced by encodeEPOCH1.
inString
- the epoch in string representation
CDFException
- if a bad epoch value is passed in inStringpublic static double parse2(java.lang.String inString) throws CDFException
Format: yyyymmddhhmmss Examples: 19950508000000 19671231235959The expected format is the same as that produced by encodeEPOCH2.
inString
- the epoch in string representation
CDFException
- if a bad epoch value is passed in inStringpublic static double parse3(java.lang.String inString) throws CDFException
Format: yyyy-mm-ddThh:mm:ss.cccZ Examples: 1990-04-01T03:05:02.000Z 1993-10-10T23:45:49.999ZThe expected format is the same as that produced by encodeEPOCH3.
inString
- the epoch in string representation
CDFException
- if a bad epoch value is passed in inStringpublic static double parse4(java.lang.String inString) throws CDFException
Format: yyyy-mm-ddThh:mm:ss.ccc Examples: 1990-04-01T03:05:02.000 1993-10-10T23:45:49.999The expected format is the same as that produced by encodeEPOCH3.
inString
- the epoch in string representation
CDFException
- if a bad epoch value is passed in inStringpublic static java.lang.String encode(double epoch)
Format: dd-mmm-yyyy hh:mm:ss.ccc Examples: 01-Apr-1990 03:05:02.000 10-Oct-1993 23:45:49.999This format is the same as that expected by parse.
epoch
- the epoch value
public static java.lang.String encode1(double epoch)
Format: yyyymmdd.ttttttt Examples: 19900401.3658893 19611231.0000000This format is the same as that expected by parse1.
epoch
- the epoch value
public static java.lang.String encode2(double epoch)
Format: yyyymmddhhmmss Examples: 19900401235959 19611231000000This format is the same as that expected by parse2.
epoch
- the epoch value
public static java.lang.String encode3(double epoch)
Format: yyyy-mm-ddThh:mm:ss.cccZ Examples: 1990-04-01T03:05:02.000Z 1993-10-10T23:45:49.999ZThis format is the same as that expected by parse3.
epoch
- the epoch value
public static java.lang.String encode4(double epoch)
Format: yyyy-mm-ddThh:mm:ss.ccc Examples: 1990-04-01T03:05:02.000 1993-10-10T23:45:49.999This format is the same as that expected by parse3.
epoch
- the epoch value
public static java.lang.String encodex(double epoch, java.lang.String formatString)
epoch
- the epoch valueformatString
- a string representing the desired
format of the epoch
public static double compute(long year, long month, long day, long hour, long minute, long second, long msec) throws CDFException
year
- the yearmonth
- the monthday
- the dayhour
- the hourminute
- the minutesecond
- the secondmsec
- the millisecond
CDFException
- an ILLEGAL_EPOCH_FIELD if an illegal
component value is detected.public static long[] breakdown(double epoch)
epoch
- the epoch value to break down
Index | Part |
0 | year |
1 | month |
2 | day |
3 | hour |
4 | minute |
5 | second |
6 | msec |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |