gov.ornl.mercury3.dwr_utils

## Class DateUtil

- java.lang.Object
- - gov.ornl.mercury3.dwr_utils.DateUtil

-     public class DateUtil
      extends Object

  ornldaac3
  Author:
    zzr @Modified by: Ranjeet Devarakonda

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Calendar` | `dateToCalendar(Date date)` Change java.util.Date to java.util.Calendar
    `String` | `dateToString(Calendar calendarDate)` Change java.util.Calendar to String
    `String` | `dateToString(Calendar calendarDate, String outPutFormat)` Change java.util.Calendar to String
    `String` | `dateToString(Date aDate)` Change java.util.Date to String
    `String` | `dateToString(Date aDate, String format)` Change java.util.Date to String with the specific format
    `long` | `daysBetween(Date d1, Date d2)` This returns number of days between the two dates.
    `int` | `getDate(String calDate, String value)` this returns date or month or year based on the input parameter
    `static DateUtil` | `getInstance()` Returns the single instance, creating one if it's when the first time this method is called.
    `String` | `getMonthString(int month)` to get the month name
    `Calendar` | `stringToCalendar(String strDate)` Change String date to java.util.Calendar
    `Calendar` | `stringToCalendar(String strDate, String strFormat)` Change String date to java.util.Calendar
    `Date` | `toDate(String dateString)` Change string to java.util.Date -depricated
    `Date` | `toDate(String dateString, String format)` Change java.util.Date to String

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static DateUtil getInstance()

      Returns the single instance, creating one if it's when the first time this method is called.
      Returns:
        DateUtil The single instance.

    - #### getDate

          public int getDate(String calDate,
                    String value)

      this returns date or month or year based on the input parameter
      Parameters:
        `Date` - as String dd-mm-yyyy format
        `value` - String this must be a month or Date or Year
      Returns:
        int value of the date or month or year

    - #### toDate

          public Date toDate(String dateString)

      Change string to java.util.Date -depricated
      Parameters:
        `String` - date
      Returns:
        java.util.Date date

    - #### toDate

          public Date toDate(String dateString,
                    String format)

      Change java.util.Date to String
      Parameters:
        `String` - date
        `Sring` - format
      Returns:
        java.util.date

    - #### daysBetween

          public long daysBetween(Date d1,
                         Date d2)

      This returns number of days between the two dates.
      Parameters:
        `Date` - date1
        `Date` - date2
      Returns:
        long number of days

    - #### dateToCalendar

          public Calendar dateToCalendar(Date date)

      Change java.util.Date to java.util.Calendar
      Parameters:
        `java.util.Date` - date
      Returns:
        java.util.Calendar

    - #### stringToCalendar

          public Calendar stringToCalendar(String strDate)

      Change String date to java.util.Calendar
      Parameters:
        `String` - date
      Returns:
        java.util.Calendar

    - #### stringToCalendar

          public Calendar stringToCalendar(String strDate,
                                  String strFormat)

      Change String date to java.util.Calendar
      Parameters:
        `String` - date
      Returns:
        java.util.Calendar

    - #### dateToString

          public String dateToString(Date aDate)

      Change java.util.Date to String
      Parameters:
        `Date` -
      Returns:
        String

    - #### dateToString

          public String dateToString(Date aDate,
                            String format)

      Change java.util.Date to String with the specific format
      Parameters:
        `Date` -
      Returns:
        String

    - #### dateToString

          public String dateToString(Calendar calendarDate)

      Change java.util.Calendar to String
      Parameters:
        `java.util.Calendar` -
      Returns:
        String date

    - #### dateToString

          public String dateToString(Calendar calendarDate,
                            String outPutFormat)

      Change java.util.Calendar to String
      Parameters:
        `java.util.Calendar` -
      Returns:
        String date

    - #### getMonthString

          public String getMonthString(int month)

      to get the month name
      Parameters:
        `int` - month number
      Returns:
        String month name

Copyright © 2016. All rights reserved.