SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.time
Class JodaTimeUtils

java.lang.Object
  extended by com.numericalmethod.suanshu.time.JodaTimeUtils

public class JodaTimeUtils
extends java.lang.Object


Field Summary
static org.joda.time.DateTime BEGINNING_OF_TIME
          This represents a time before all (representable) times.
static long BEGINNING_OF_TIME_LONG
          This represents a time before all (representable) times, in long representation.
static org.joda.time.DateTime ENDING_OF_TIME
          This represents a time after all (representable) times.
static long ENDING_OF_TIME_LONG
          This represents a time after all (representable) times, in long representation.
static org.joda.time.DateTimeZone EST
          EST
static org.joda.time.DateTimeZone GMT
          GMT
static org.joda.time.DateTimeZone HONG_KONG
          Hong Kong
static org.joda.time.DateTimeZone LONDON
          London
static org.joda.time.DateTimeZone NY
          New York
static org.joda.time.DateTime ORIGIN
          a reference time "origin": 1970 January 1, midnight, UTC I
static org.joda.time.DateTimeZone PARIS
          Paris
static org.joda.time.DateTimeZone TOKYO
          Tokyo
 
Method Summary
static org.joda.time.DateTime getDate(int year, int month, int day, org.joda.time.DateTimeZone tz)
          Construct a DateTime object with year, month, day, and time zone.
static org.joda.time.DateTime getDateTime(java.lang.String str)
          Construct a DateTime object from a String which ends in TimeZone specification.
static org.joda.time.DateTime getDateTime(java.lang.String str, java.text.DateFormat format, org.joda.time.DateTimeZone tz)
          Construct a DateTime object from a String with no TimeZone specified in the String
static org.joda.time.DateTime nextWeekDay(org.joda.time.DateTime time)
          Get the next weekday, i.e., skipping Saturdays and Sundays.
static org.joda.time.DateTime previousWeekDay(org.joda.time.DateTime time)
          Get the previous weekday, i.e., skipping Saturdays and Sundays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NY

public static final org.joda.time.DateTimeZone NY
New York


LONDON

public static final org.joda.time.DateTimeZone LONDON
London


PARIS

public static final org.joda.time.DateTimeZone PARIS
Paris


TOKYO

public static final org.joda.time.DateTimeZone TOKYO
Tokyo


HONG_KONG

public static final org.joda.time.DateTimeZone HONG_KONG
Hong Kong


GMT

public static final org.joda.time.DateTimeZone GMT
GMT


EST

public static final org.joda.time.DateTimeZone EST
EST


ORIGIN

public static final org.joda.time.DateTime ORIGIN
a reference time "origin": 1970 January 1, midnight, UTC I


BEGINNING_OF_TIME

public static final org.joda.time.DateTime BEGINNING_OF_TIME
This represents a time before all (representable) times.


BEGINNING_OF_TIME_LONG

public static final long BEGINNING_OF_TIME_LONG
This represents a time before all (representable) times, in long representation.


ENDING_OF_TIME

public static final org.joda.time.DateTime ENDING_OF_TIME
This represents a time after all (representable) times.


ENDING_OF_TIME_LONG

public static final long ENDING_OF_TIME_LONG
This represents a time after all (representable) times, in long representation.

Method Detail

getDate

public static org.joda.time.DateTime getDate(int year,
                                             int month,
                                             int day,
                                             org.joda.time.DateTimeZone tz)
Construct a DateTime object with year, month, day, and time zone. It is set to mid-night.

Parameters:
year - year
month - month of the year
day - day of the month
tz - time zone
Returns:
a DateTime object

getDateTime

public static org.joda.time.DateTime getDateTime(java.lang.String str)
                                          throws java.text.ParseException
Construct a DateTime object from a String which ends in TimeZone specification.

Parameters:
str - the date-time string
Returns:
a DateTime representation
Throws:
java.text.ParseException

getDateTime

public static org.joda.time.DateTime getDateTime(java.lang.String str,
                                                 java.text.DateFormat format,
                                                 org.joda.time.DateTimeZone tz)
                                          throws java.text.ParseException
Construct a DateTime object from a String with no TimeZone specified in the String

Parameters:
str - the date-time string
format - the formatter
tz - the time zone; null if default time zone
Returns:
a DateTime representation
Throws:
java.text.ParseException

nextWeekDay

public static org.joda.time.DateTime nextWeekDay(org.joda.time.DateTime time)
Get the next weekday, i.e., skipping Saturdays and Sundays.

Parameters:
time - a DateTime
Returns:
next weekday

previousWeekDay

public static org.joda.time.DateTime previousWeekDay(org.joda.time.DateTime time)
Get the previous weekday, i.e., skipping Saturdays and Sundays.

Parameters:
time - a DateTime
Returns:
the previous weekday

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.