ucar.visad
Class UtcDate

java.lang.Object
  extended by ucar.visad.UtcDate

public final class UtcDate
extends Object

A set of utility functions for UTC DateTimes

Version:
$Revision: 1.6 $ $Date: 2007/05/22 13:52:35 $
Author:
Unidata Development Team

Field Summary
static String DEFAULT_PATTERN
          Default time format
static TimeZone GMT
          GMT Timezone
static String HH_FORMAT
          hour format string (HH)
static String HH_MM_FORMAT
          hour:minute format string (HH:mm)
static String HMS_FORMAT
          hour:minute:second format string (HH:mm:ss)
static String MACRO_TIMESTAMP
          timestamp macro identifier
static String YMD_FORMAT
          Year-Month-Day format string
 
Constructor Summary
UtcDate()
          default constructor
 
Method Summary
static String applyTimeMacro(String template, DateTime dttm)
          Apply the timestamp macro to the string
static String applyTimeMacro(String template, DateTime dttm, String noTimeLabel)
          Apply the timestamp macro to the string
static boolean containsTimeMacro(String s)
          See if the string contains a timestamp macro
static String formatUtcDate(DateTime dt, String pattern)
          Return a formated date in UTC time.
static String getHH(DateTime dt)
          Get the hour as a String.
static String getHHMM(DateTime dt)
          Get the hour:minute as a String.
static String getHMS(DateTime dt)
          Get the hour/minute/second as a String
static String getUtcDate(DateTime dt)
          Get the full datetime using the DEFAULT_FORMAT
static String getYMD(DateTime dt)
          Get the year-month-day as a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MACRO_TIMESTAMP

public static final String MACRO_TIMESTAMP
timestamp macro identifier

See Also:
Constant Field Values

YMD_FORMAT

public static final String YMD_FORMAT
Year-Month-Day format string

See Also:
Constant Field Values

HMS_FORMAT

public static final String HMS_FORMAT
hour:minute:second format string (HH:mm:ss)

See Also:
Constant Field Values

HH_MM_FORMAT

public static final String HH_MM_FORMAT
hour:minute format string (HH:mm)

See Also:
Constant Field Values

HH_FORMAT

public static final String HH_FORMAT
hour format string (HH)

See Also:
Constant Field Values

GMT

public static final TimeZone GMT
GMT Timezone


DEFAULT_PATTERN

public static final String DEFAULT_PATTERN
Default time format

See Also:
Constant Field Values
Constructor Detail

UtcDate

public UtcDate()
default constructor

Method Detail

getHH

public static String getHH(DateTime dt)
Get the hour as a String.

Parameters:
dt - DateTime to use
Returns:
hour as a String (HH)

containsTimeMacro

public static boolean containsTimeMacro(String s)
See if the string contains a timestamp macro

Parameters:
s - the string
Returns:
true if it contains the macro

applyTimeMacro

public static String applyTimeMacro(String template,
                                    DateTime dttm)
Apply the timestamp macro to the string

Parameters:
template - the timestamp template
dttm - the DateTime
Returns:
a formatted string of form template

applyTimeMacro

public static String applyTimeMacro(String template,
                                    DateTime dttm,
                                    String noTimeLabel)
Apply the timestamp macro to the string

Parameters:
template - the timestamp template
dttm - the DateTime
noTimeLabel - the label if dttm is null;
Returns:
a formatted string of form template

getHHMM

public static String getHHMM(DateTime dt)
Get the hour:minute as a String.

Parameters:
dt - DateTime to use
Returns:
hour:minute as a String (HH:mm);

getYMD

public static String getYMD(DateTime dt)
Get the year-month-day as a String

Parameters:
dt - DateTime to use
Returns:
year-month-day as a String (yyyy-MM-dd);

getHMS

public static String getHMS(DateTime dt)
Get the hour/minute/second as a String

Parameters:
dt - DateTime to use
Returns:
the hour/minute/second as a String (HH:mm:ss)

getUtcDate

public static String getUtcDate(DateTime dt)
Get the full datetime using the DEFAULT_FORMAT

Parameters:
dt - DateTime to use
Returns:
the formatted UTC date

formatUtcDate

public static String formatUtcDate(DateTime dt,
                                   String pattern)
Return a formated date in UTC time. Uses DateTime.formatString() with the UTC (GMT) time zone.

Parameters:
dt - DateTime object
pattern - format pattern
Returns:
formatted date.