Обсуждение: format query

Поиск
Список
Период
Сортировка

format query

От
"enzo venegas palacios"
Дата:
I am trying to build a query sql that select all rows in my table with a
spesific month (format timestamp, yyy-mm-dd hh:mm:ss), for example, all of
january, select * from table where field_date = 01.
but i don't know the specific query

I hope somebody can help me.

enzo
---------------------------------------------------------
�Quieres saber c�mo te ira en el amor? �en el trabajo? Nosotros te lo contamos http://astrocentro.mujeractual.com/ya
ADSL + Llamadas 24 horas: desde 28,95 �/mes + IVA. Navega y habla de forma ilimitada. Sin compromiso de permanencia.
http://acceso.ya.com/ADSLllamadas/


Re: format query

От
Frank Bax
Дата:
At 07:22 AM 3/9/05, enzo venegas palacios wrote:
>I am trying to build a query sql that select all rows in my table with a
>spesific month (format timestamp, yyy-mm-dd hh:mm:ss), for example, all of
>january, select * from table where field_date = 01.
>but i don't know the specific query


WHERE date_part('month',field_date) = 01


Re: format query

От
"Todd Lewis"
Дата:
use the to_char function to specify the format in your where clause.



>
> I am trying to build a query sql that select all rows in my table with a
> spesific month (format timestamp, yyy-mm-dd hh:mm:ss), for example, all of
> january, select * from table where field_date = 01.
> but i don't know the specific query
>
> I hope somebody can help me.
>
> enzo
> ---------------------------------------------------------
> ¿Quieres saber cómo te ira en el amor? ¿en el trabajo? Nosotros te lo contamos http://astrocentro.mujeractual.com/ya
> ADSL + Llamadas 24 horas: desde 28,95 €/mes + IVA. Navega y habla de forma ilimitada. Sin compromiso de permanencia.
http://acceso.ya.com/ADSLllamadas/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster



Re: format query

От
Christopher Kings-Lynne
Дата:
> I am trying to build a query sql that select all rows in my table with a
> spesific month (format timestamp, yyy-mm-dd hh:mm:ss), for example, all of
> january, select * from table where field_date = 01.
> but i don't know the specific query

select * from table where extract(month from field) = 1;

Chris

Re: format query

От
"enzo venegas palacios"
Дата:
I need to prove to be alone the date and not the hour of a table with format
timestamp.

please.


enzo
---------------------------------------------------------
Redecora tu m�vil. Redecora tu vida. �Por qu� no? Con http://logos.ya.com es posible
ADSL + Llamadas 24 horas: desde 28,95 �/mes + IVA. Navega y habla de forma ilimitada. Sin compromiso de permanencia.
http://acceso.ya.com/ADSLllamadas/


Re: format query

От
sundaravel
Дата:
enzo venegas palacios wrote:

>I need to prove to be alone the date and not the hour of a table with format
>timestamp.
>
>please.
>
>
>enzo
>---------------------------------------------------------
>Redecora tu móvil. Redecora tu vida. ¿Por qué no? Con http://logos.ya.com es posible
>ADSL + Llamadas 24 horas: desde 28,95 €/mes + IVA. Navega y habla de forma ilimitada. Sin compromiso de permanencia.
http://acceso.ya.com/ADSLllamadas/
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
>
y u can try like this..

$arrDate = getdate();
$current_timestamp = $arrDate[0];

echo $current_timestamp;

// Output
1111070429

-S Sunder




Re: format query

От
"enzo venegas palacios"
Дата:
i need to display only the date, for example

$fecha = dd/mm/yyy hh:mm:ss (format timestamp)

see only dd/mm/yyyy

how extract only date from the var ($fecha)


enzo
---------------------------------------------------------
Redecora tu m�vil. Redecora tu vida. �Por qu� no? Con http://logos.ya.com es posible
ADSL + Llamadas 24 horas: desde 28,95 �/mes + IVA. Navega y habla de forma ilimitada. Sin compromiso de permanencia.
http://acceso.ya.com/ADSLllamadas/


Re: format query

От
"Gary Hoffman"
Дата:
enzovenegas@mixmail.com writes:
>I need to prove to be alone the date and not the hour of a table with
>format
>timestamp.
>
>please.

Enzo,

I've used two different methods:

-The SQL string function substr(string) gets the parts of the result that
you need, where the date is cast as text.
-The PostgreSql SQL function epoch(timestamp) in your query gets the
timestamp as a numeric that the PHP function date() can format however you
want.

Good luck,
Gary

**************************************************************************
* Gary B. Hoffman, Computing Services Manager  e-mail: ghoffman@ucsd.edu *
* Graduate School of International Relations and Pacific Studies (IR/PS) *
* University of California, San Diego (UCSD)       voice: (858) 534-1989 *
* 9500 Gilman Dr.  MC 0519                           fax: (858) 534-3939 *
* La Jolla, CA 92093-0519 USA                 web: http://irps.ucsd.edu/ *
**************************************************************************