Thread: format query

format query

From
"enzo venegas palacios"
Date:
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

From
Frank Bax
Date:
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

From
"Todd Lewis"
Date:
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

From
Christopher Kings-Lynne
Date:
> 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

From
"enzo venegas palacios"
Date:
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

From
sundaravel
Date:
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

From
"enzo venegas palacios"
Date:
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

From
"Gary Hoffman"
Date:
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/ *
**************************************************************************