List:General Discussion« Previous MessageNext Message »
From:Don Read Date:May 25 1999 1:01am
Subject:RE: Date prior to Epoch
View as plain text  
On 24-May-99 Shalendra Majmundar wrote:
> I need birthdate field. I'd like to use date/time functions, but they depend
> on Epoch. So, effectively I can not
> calculate age of a person born before 1970. Any suggestions?
> 
> 

Why do you beleive that ?      did you even try it ?

mysql> show fields from daze;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| dt    | date        | YES  |     | NULL    |       |
| name  | varchar(32) | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.23 sec)

mysql> select * from daze;
+------------+-------------------+
| dt         | name              |
+------------+-------------------+
| 1959-06-21 | Joe Shmo          |
| 1961-12-22 | Betty Sue Baker   |
| 1756-01-27 | Wolfgang A Mozart |
| 2317-11-13 | Obi W Kenobi      |
+------------+-------------------+
4 rows in set (0.27 sec)

mysql> select (TO_DAYS(current_date) - TO_DAYS(dt)) / 365.25 as age, name from
daze;
+-----------+-------------------+
| age       | name              |
+-----------+-------------------+
|   39.9233 | Joe Shmo          |
|   37.4182 | Betty Sue Baker   |
|  243.3155 | Wolfgang A Mozart |
| -318.4668 | Obi W Kenobi      |
+-----------+-------------------+
4 rows in set (0.25 sec)



Regards,
---
Don Read                                 dread@stripped
EDP Manager                                  dread@stripped
Calcasieu Lumber Co.                               Austin TX
-- Meddle not in the affairs of dragons, for you are crunchy
    and taste good with ketchup.

Thread
INSERTSandrine C.21 May
  • Re: INSERTThimble Smith21 May
  • Re: INSERTJim Faucette21 May
Re: INSERTRuprecht Helms21 May
  • Date prior to EpochShalendra Majmundar24 May
    • RE: Date prior to EpochDon Read25 May