function for current date-time

Started by Harpreet Dhaliwalover 19 years ago5 messagesgeneral
Jump to latest
#1Harpreet Dhaliwal
harpreet.dhaliwal01@gmail.com

Hi,
I have a timestamp field in my table and want to set a default value of
current date/time for it.
What should i enter as its default value? is there any function like now()
in postgres?

Thanks,
~Harpreet

#2Bricklen Anderson
banderson@presinet.com
In reply to: Harpreet Dhaliwal (#1)
Re: function for current date-time

Harpreet Dhaliwal wrote:

Hi,
I have a timestamp field in my table and want to set a default value of
current date/time for it.
What should i enter as its default value? is there any function like
now() in postgres?

Thanks,
~Harpreet

http://www.postgresql.org/docs/8.1/interactive/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

#3Reid Thompson
Reid.Thompson@ateb.com
In reply to: Harpreet Dhaliwal (#1)
Re: function for current date-time

On Mon, 2006-10-16 at 14:56 -0400, Harpreet Dhaliwal wrote:

Hi,
I have a timestamp field in my table and want to set a default value
of current date/time for it.
What should i enter as its default value? is there any function like
now() in postgres?

Thanks,
~Harpreet

test=# select now();
now
-------------------------------
2006-10-16 15:03:13.174644-04
(1 row)

#4A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Harpreet Dhaliwal (#1)
Re: function for current date-time

am Mon, dem 16.10.2006, um 14:56:27 -0400 mailte Harpreet Dhaliwal folgendes:

Hi,
I have a timestamp field in my table and want to set a default value of current
date/time for it.
What should i enter as its default value? is there any function like now() in
postgres?

Yes, now() ;-)

test=# create table foo (id int, ts timestamp default now());
CREATE TABLE
test=# insert into foo (id, ts) values (1, default);
INSERT 0 1
test=# select * from foo;
id | ts
----+---------------------------
1 | 2006-10-16 21:18:15.75039
(1 row)

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

#5Jimmy Zhang
crackeur@comcast.net
In reply to: Harpreet Dhaliwal (#1)
[ANN] VTD-XML 1.7 released

XimpleWare released Version 1.7 of VTD-XML, the next generation XML
parser that goes beyond DOM and SAX, under GPL. VTD-XML is getting
faster, leaner, more stable and complete with this release. New features
included in this releases are:

* Additional XPath functions support
* Union Expression
* A rewritten VTDNav implementation
* Various bug fixes in VTDGen and XPath evaluation

Please visit http://vtd-xml.sf.net for the latest release.

For further reading, please refer to the following articles:
a.. Simplify XML Processing with VTD-XML
a.. Cut, Paste, Assemble and Split XML files with VTD-XML
a.. XML on a Chip
a.. Process Large XML Files with VTD-XML
a.. The performance Woe of Binary XML
a.. VTD-XML: The Next Generation XML Parser