Inserting the current date

Started by johnover 24 years ago8 messagesgeneral
Jump to latest
#1john
servobit@m.r.c

Hi,

I have a field (Date type) and I'd like to insert the current date and time.

e.g.:

insert into my_table( my_date_field ) values ( sysdate );

Is there an equivalent to Oracle's "sysdate" keyword?

Thanks,

John

#2john
servobit@m.r.c
In reply to: john (#1)
Re: Inserting the current date

Nevermind, I found it here:

"john" <servobit@m.r.c> wrote in message
news:ZNwQ7.642$CR2.230891@typhoon.maine.rr.com...

Hi,

I have a field (Date type) and I'd like to insert the current date and

time.

Show quoted text

e.g.:

insert into my_table( my_date_field ) values ( sysdate );

Is there an equivalent to Oracle's "sysdate" keyword?

Thanks,

John

#3john
servobit@m.r.c
In reply to: john (#1)
Re: Inserting the current date
#4Noname
wsheldah@lexmark.com
In reply to: john (#3)
Re: Inserting the current date

The now function will insert the current date and time:

insert into my_table( my_date_field ) values ( sysdate );

--Wes Sheldahl

"john" <servobit%www2.us.postgresql.org@interlock.lexmark.com> on 12/08/2001
05:49:29 PM

To: pgsql-general%postgresql.org@interlock.lexmark.com
cc: (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: [GENERAL] Inserting the current date

Hi,

I have a field (Date type) and I'd like to insert the current date and time.

e.g.:

insert into my_table( my_date_field ) values ( sysdate );

Is there an equivalent to Oracle's "sysdate" keyword?

Thanks,

John

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#5Thomas Lockhart
lockhart@fourpalms.org
In reply to: john (#1)
Re: Inserting the current date

Is there an equivalent to Oracle's "sysdate" keyword?

'now'

or

date 'now'

(note single quotes; they are treated like values, not a keyword).

- Thomas

#6Jason Earl
jason.earl@simplot.com
In reply to: john (#1)
Re: Inserting the current date

What exactly does sysdate do? Is it anything like CURRENT_TIME,
CURRENT_DATE, or now()?

Jason

"john" <servobit@www2.us.postgresql.org> writes:

Show quoted text

Hi,

I have a field (Date type) and I'd like to insert the current date and time.

e.g.:

insert into my_table( my_date_field ) values ( sysdate );

Is there an equivalent to Oracle's "sysdate" keyword?

Thanks,

John

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#7Bruce Momjian
bruce@momjian.us
In reply to: Thomas Lockhart (#5)
Re: Inserting the current date

Is there an equivalent to Oracle's "sysdate" keyword?

'now'

or

date 'now'

Isn't CURRENT_TIMESTAMP what we should be recommending? Just checking.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#8Thomas Lockhart
lockhart@fourpalms.org
In reply to: Bruce Momjian (#7)
Re: Inserting the current date

Is there an equivalent to Oracle's "sysdate" keyword?

Isn't CURRENT_TIMESTAMP what we should be recommending? Just checking.

Yup.

- Thomas