Ver Mensaje Individual
  #25 (permalink)  
Antiguo 27/11/2002, 05:58
Avatar de mauriciolangea
mauriciolangea
 
Fecha de Ingreso: enero-2002
Mensajes: 59
Antigüedad: 22 años, 10 meses
Puntos: 0
Interbase

Tema: Interbase

Pregunta: ¿Como se usa la función extract?

Respuesta:

El operador EXTRACT te permite la devolución de diferentes partes de un valor TIMESTAMP. El operador EXTRACT no hace distinción entre dialectos cuando está formateando o devolviendo la información.


select extract (year from timestamp_fld) from table_name;
=======
1999

select extract (year from timestamp_fld) from table_name;
=======
1999

select extract (month from timestamp_fld) from table_name;
=======
6

select extract (day from timestamp_fld) from table_name;
=======
25

select extract (minute from timestamp_fld) from table_name;
=======
24

select extract (second from timestamp_fld) from table_name;
============
35.0000

select extract (weekday from timestamp_fld) from table_name;
=======
5

select extract (yearday from timestamp_fld) from table_name;
=======
175

select extract (month from timestamp_fld) ||
'-' || extract (day from timestamp_fld) ||
'-' || extract (year from timestamp_fld) from table_name;
====================
6-25-1999