Current time in Ingres

Current time in Ingres

Post by David Wils » Fri, 12 Aug 1994 00:20:10





>Sorry for this newbie question but I still haven't found
>a solution to obtain the current time.

>I want to use it for date arithmetics like
>SELECT DATE(NOW) - distr_date FROM distribution

You're really close here.  Use SELECT DATE('NOW')   to get
the current date and time (date('today') will give you midnight
of current date).  I think all you need is the fact that 'now' is a
string, not an Ingres name.

SQL Reference manual will have more info than you could ever want
about the DATE datatype, and functions operating on it.  Dave-Bob
sez check it out.

Dave Wilson
Ingres (ASK) 7/90-6/94

Quote:>            ^^^
>The dbmsinfo - _bintim seconds are not the finest solution
>and the result cannot be passed to _date() or date_gmt().

>Any hints?

>Ingo

--
Dave Wilson

--My thoughts, my ideas; no one else would admit to wanting them.
  (Sometimes I'm not sure *I* do.)
 
 
 

Current time in Ingres

Post by Ingo Gring » Thu, 11 Aug 1994 19:23:48


Sorry for this newbie question but I still haven't found
a solution to obtain the current time.

I want to use it for date arithmetics like
SELECT DATE(NOW) - distr_date FROM distribution
            ^^^
The dbmsinfo - _bintim seconds are not the finest solution
and the result cannot be passed to _date() or date_gmt().

Any hints?

Ingo

 
 
 

1. Current Time in Ingres

Hi Ingo,

I don't have a manual here but I'm pretty sure that:

      SELECT date ('now')

gives the current date and time as a value of the Ingres date datatype.

This value can then be used for SQL date arithmetic, see the SQL
Reference Manual for further info. But basically subtracting 2 dates
gives an interval value as you would expect.

The Ingres date datatype can be used for date, time, date / time,
interval...  It's smart enough to know what kind of value it's dealing
with. In fact the type info is stored at the front of the 12-byte date
value (which is why it makes a lousy primary key).

This seems too obvious tho', is there some subtlety in yr question that
I've missed? Hope some of this helps anyway.

Angela

--

Life's an illusion / love is a dream...

2. How to insert records into a table from another table

3. Current date without current time

4. GA-Atlanta-104874--ORACLE-UNIX-Programmer-Oracle / UNIX

5. Extract time less than or equal to the current time

6. US - Seattle, WA - Senior DBA (Oracle/SQL Server)

7. Run Time vs Design Time - No Current Record

8. Q: Updating all rows in a table...

9. INGRES date data type vs Standard Time/Daylight Savings Time change

10. migration to ingres current release?

11. Command to find Current Ingres Version

12. migration to ingres current release?

13. Restores, current time stamps, etc