JavaDateFactory (Jython API documentation)
Date: 2022-09-10

com.ziclix.python.sql

## Class JavaDateFactory

- java.lang.Object
- - com.ziclix.python.sql.JavaDateFactory

- All Implemented Interfaces:
    DateFactory

      public class JavaDateFactory
      extends java.lang.Object
      implements DateFactory

  Produce java.[util|sql] type dates.
  Author:
    brian zimmer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JavaDateFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PyObject` | `Date(int year, int month, int day)` This function constructs an object holding a date value.
    `PyObject` | `DateFromTicks(long ticks)` This function constructs an object holding a date value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).
    `PyObject` | `Time(int hour, int minute, int second)` This function constructs an object holding a time value.
    `PyObject` | `TimeFromTicks(long ticks)` This function constructs an object holding a time value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).
    `PyObject` | `Timestamp(int year, int month, int day, int hour, int minute, int second)` This function constructs an object holding a time stamp value.
    `PyObject` | `TimestampFromTicks(long ticks)` This function constructs an object holding a time stamp value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).

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

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

- - ### Constructor Detail

    - #### JavaDateFactory

          public JavaDateFactory()

  - ### Method Detail

    - #### Date

          public PyObject Date(int year,
                               int month,
                               int day)

      This function constructs an object holding a date value.
      Specified by:
        `Date` in interface `DateFactory`
      Parameters:
        `year` - to set
        `month` - to set
        `day` - to set
      Returns:
        date as PyObject

    - #### Time

          public PyObject Time(int hour,
                               int minute,
                               int second)

      This function constructs an object holding a time value.
      Specified by:
        `Time` in interface `DateFactory`
      Parameters:
        `hour` - to set
        `minute` - to set
        `second` - to set
      Returns:
        time as PyObject

    - #### Timestamp

          public PyObject Timestamp(int year,
                                    int month,
                                    int day,
                                    int hour,
                                    int minute,
                                    int second)

      This function constructs an object holding a time stamp value.
      Specified by:
        `Timestamp` in interface `DateFactory`
      Parameters:
        `year` - to set
        `month` - to set
        `day` - to set
        `hour` - to set
        `minute` - to set
        `second` - to set
      Returns:
        time stamp as PyObject

    - #### DateFromTicks

          public PyObject DateFromTicks(long ticks)

      This function constructs an object holding a date value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).

      Note: The DB API 2.0 spec calls for time in seconds since the epoch while the Java Date object returns time in milliseconds since the epoch. This module adheres to the python API and will therefore use time in seconds rather than milliseconds, so adjust any Java code accordingly.

      Specified by:
        `DateFromTicks` in interface `DateFactory`
      Parameters:
        `ticks` - number of seconds since the epoch
      Returns:
        PyObject

    - #### TimeFromTicks

          public PyObject TimeFromTicks(long ticks)

      This function constructs an object holding a time value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).

      Note: The DB API 2.0 spec calls for time in seconds since the epoch while the Java Date object returns time in milliseconds since the epoch. This module adheres to the python API and will therefore use time in seconds rather than milliseconds, so adjust any Java code accordingly.

      Specified by:
        `TimeFromTicks` in interface `DateFactory`
      Parameters:
        `ticks` - number of seconds since the epoch
      Returns:
        PyObject

    - #### TimestampFromTicks

          public PyObject TimestampFromTicks(long ticks)

      This function constructs an object holding a time stamp value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).

      Note: The DB API 2.0 spec calls for time in seconds since the epoch while the Java Date object returns time in milliseconds since the epoch. This module adheres to the python API and will therefore use time in seconds rather than milliseconds, so adjust any Java code accordingly.

      Specified by:
        `TimestampFromTicks` in interface `DateFactory`
      Parameters:
        `ticks` - number of seconds since the epoch
      Returns:
        PyObject

Jython homepage