RE: [SQL] 'now - 4 hours ago' ?
RE: [SQL] 'now - 4 hours ago' ?
От:
"Jackson, DeJuan" <djackson@cpsgroup.com>
Дата:
> On Thu, 18 Jun 1998, Petter Reinholdtsen wrote: > > | CREATE TABLE testdate( > | received timestamp DEFAULT CURRENT_DATE, > | info text NOT NULL > | ); > > I think CURRENT_DATE will be parsed to the table creation's time. > so better to use: > > CREATE TABLE testdate ( > received timestamp DEFAULT timestamp(now()), > info text NOT NULL > ); > > Redax > DATETIME has more features and a wider range than TIMESTAMP, so if I were you that's what I'd be using. try: SELECT NOW()::DATETIME - '@4 hours'::TIMESPAN; I suggest sticking with DATETIME as much as you can. -DEJ