Обсуждение: Timestamp

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

Timestamp

От
Abdul Wahab Dahalan
Дата:
Hi !
In my database I've a field "departure" with timestamp without time zone 
data type.
eg :
departure
2003-11-01 14:29:46

Now I want to select it as in this format 01-11-2003 14:29:46 How should 
I do it?.

Thank you for any help.



Re: Timestamp

От
Tomasz Myrta
Дата:
Dnia 2003-10-22 10:02, Użytkownik Abdul Wahab Dahalan napisał:

> Hi !
> In my database I've a field "departure" with timestamp without time zone 
> data type.
> eg :
> departure
> 2003-11-01 14:29:46
> 
> Now I want to select it as in this format 01-11-2003 14:29:46 How should 
> I do it?.

You can find it in documentation - 6.7. Data Type Formatting Functions

select to_char(departure,'DD-MM-YYYY HH24:MI:SS') ...


Regards,
Tomasz Myrta



Re: Timestamp

От
achill@matrix.gatewaynet.com
Дата:
On Wed, 22 Oct 2003, Abdul Wahab Dahalan wrote:

> Hi !
> In my database I've a field "departure" with timestamp without time zone 
> data type.
> eg :
> departure
> 2003-11-01 14:29:46

Maybe 
SET DateStyle TO 'German' ; 
SELECT replace(departure,'.','-') from <yourtable> ;

is close to what you want,
but better leave it default and format the date (input/output) from your 
app.

> 
> Now I want to select it as in this format 01-11-2003 14:29:46 How should 
> I do it?.
> 
> Thank you for any help.
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
-Achilleus



Re: Timestamp

От
Theodore Petrosky
Дата:
Check this out....

http://www.postgresql.org/docs/7.3/static/functions-formatting.html

to_char(departure, 'MM-DD-YYYY HH24:MI:SS') as
newformatdeparture


Ted
--- Abdul Wahab Dahalan <wahab@mimos.my> wrote:
> Hi !
> In my database I've a field "departure" with
> timestamp without time zone 
> data type.
> eg :
> departure
> 2003-11-01 14:29:46
> 
> Now I want to select it as in this format 01-11-2003
> 14:29:46 How should 
> I do it?.
> 
> Thank you for any help.
> 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com