FunctionsMySQL
This class implements some MySQL-specific functions.
| Methods |
| static String |
date(String dateTime)
See
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date
This function is dependent on the exact formatting of the MySQL date/time
string.
|
| static String |
date(String dateTime)
See
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date
This function is dependent on the exact formatting of the MySQL date/time
string.
Parameters:
dateTime - The date/time String from which to extract just the date
part.
Returns:
the date part of the given date/time String argument.
|
| static String |
fromUnixTime(int seconds)
See
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
|
| static String |
fromUnixTime(int seconds)
See
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
Parameters:
seconds - The current timestamp in seconds.
Returns:
a formatted date/time String in the format "yyyy-MM-dd HH:mm:ss".
|
| static String |
fromUnixTime(int seconds, String format)
See
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
|
| static String |
fromUnixTime(int seconds, String format)
See
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
Parameters:
seconds - The current timestamp in seconds.
format - The format of the date/time String to return.
Returns:
a formatted date/time String in the given format.
|
| static void |
register(Connection conn)
Register the functionality in the database.
|
| static void |
register(Connection conn) throws SQLException
Register the functionality in the database.
Nothing happens if the functions are already registered.
Parameters:
conn - the connection
|
| static int |
unixTimestamp()
Get the seconds since 1970-01-01 00:00:00 UTC.
|
| static int |
unixTimestamp()
Get the seconds since 1970-01-01 00:00:00 UTC.
See
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_unix-timestamp
Returns:
the current timestamp in seconds (not milliseconds).
|
| static int |
unixTimestamp(Timestamp timestamp)
Get the seconds since 1970-01-01 00:00:00 UTC of the given timestamp.
|
| static int |
unixTimestamp(Timestamp timestamp)
Get the seconds since 1970-01-01 00:00:00 UTC of the given timestamp.
See
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_unix-timestamp
Parameters:
timestamp - the timestamp
Returns:
the current timestamp in seconds (not milliseconds).
|