List:General Discussion« Previous MessageNext Message »
From:Roger Baklund Date:July 11 2002 11:00am
Subject:Re: MySQL DateTime subtraction question
View as plain text  
* Richard Fox
> This question relates to both mysql in general and the mysql++ C++ API in
> particular, thus the adressing to both lists.
>
> I have a DateTime object (really a formatted string) say "2002-07-10
> 11:38:38". I want to subtract some variable number of hours (from 0 to 11)
> from it. How do I accomplish this in an elegant manner?

mysql> select "2002-07-10 11:38:38" - interval 12 hour;
+------------------------------------------+
| "2002-07-10 11:38:38" - interval 12 hour |
+------------------------------------------+
| 2002-07-09 23:38:38                      |
+------------------------------------------+
1 row in set (0.00 sec)

--
Roger

Thread
questionA Dark Elf3 Apr
  • questionMichael Widenius3 Apr
  • Re: MySQL DateTime subtraction questionRoger Baklund11 Jul