Oracle 5.0 Reference Manual page 944

Table of Contents

Advertisement

If
is given, the result is formatted according to the
format
way as listed in the entry for the
mysql>
SELECT FROM_UNIXTIME(1196440219);
-> '2007-11-30 10:30:19'
mysql>
SELECT FROM_UNIXTIME(1196440219) + 0;
-> 20071130103019.000000
mysql>
SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),
->
-> '2007 30th November 10:30:59 2007'
Note: If you use
UNIX_TIMESTAMP()
values and Unix timestamp values, the conversion is lossy because the mapping is not
TIMESTAMP
one-to-one in both directions. For details, see the description of the
function.
GET_FORMAT({DATE|TIME|DATETIME},
{'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'})
Returns a format string. This function is useful in combination with the
the
STR_TO_DATE()
The possible values for the first and second arguments result in several possible format strings (for
the specifiers used, see the table in the
refers to ISO 9075, not ISO 8601.
Function Call
GET_FORMAT(DATE,'USA')
GET_FORMAT(DATE,'JIS')
GET_FORMAT(DATE,'ISO')
GET_FORMAT(DATE,'EUR')
GET_FORMAT(DATE,'INTERNAL')
GET_FORMAT(DATETIME,'USA')
GET_FORMAT(DATETIME,'JIS')
GET_FORMAT(DATETIME,'ISO')
GET_FORMAT(DATETIME,'EUR')
GET_FORMAT(DATETIME,'INTERNAL')
GET_FORMAT(TIME,'USA')
GET_FORMAT(TIME,'JIS')
GET_FORMAT(TIME,'ISO')
GET_FORMAT(TIME,'EUR')
GET_FORMAT(TIME,'INTERNAL')
can also be used as the first argument to
TIMESTAMP
function returns the same values as for DATETIME.
mysql>
SELECT DATE_FORMAT('2003-10-03',GET_FORMAT(DATE,'EUR'));
-> '03.10.2003'
mysql>
SELECT STR_TO_DATE('10.31.2003',GET_FORMAT(DATE,'USA'));
-> '2003-10-31'
[924]
HOUR(time)
Returns the hour for time. The range of the return value is
the range of
values actually is much larger, so
TIME
Date and Time Functions
DATE_FORMAT()
'%Y %D %M %h:%i:%s %x');
[931]
[927]
functions.
DATE_FORMAT()
[924]
[924]
[924]
[924]
[924]
[924]
[924]
[924]
[924]
[924]
[924]
[924]
[924]
[924]
[924]
924
format
[921]
function.
and
FROM_UNIXTIME()
[924]
[921]
function description). ISO format
Result
'%m.%d.%Y'
'%Y-%m-%d'
'%Y-%m-%d'
'%d.%m.%Y'
'%Y%m%d'
'%Y-%m-%d %H.%i.%s'
'%Y-%m-%d %H:%i:%s'
'%Y-%m-%d %H:%i:%s'
'%Y-%m-%d %H.%i.%s'
'%Y%m%d%H%i%s'
'%h:%i:%s %p'
'%H:%i:%s'
'%H:%i:%s'
'%H.%i.%s'
'%H%i%s'
GET_FORMAT()
to
0
23
can return values greater than 23.
HOUR
string, which is used the same
[923]
to convert between
UNIX_TIMESTAMP()
[921]
DATE_FORMAT()
[924], in which case the
for time-of-day values. However,
[931]
and

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents