Hi all.
I have to write an app that interacts with mySQL (I really must have done
some evil, evil stuff in a previous life to be landed with this!)
I need to work out the difference in days between values in the database and
the current date. "No problem," thought I , "I'll just use the SQL DATEDIFF
command." Heh! Well, the user interface I'm using didn't even recognise
DATEDIFF as being a function, so I decided to visit the mySQL website.
Their description of DATEDIFF is as follows:
------------------------
DATEDIFF(ARGUMENTS)
TIMEDIFF(ARGUMENTS)
[Rest of description to be added here]
NEED EXAMPLE
DATEDIFF() and TIMEDIFF() were added in MySQL 4.1.1.
------------------------
Wow! How helpful! I can't believe that they don't provided decent
documentation for their database server!
I had a quick Google, but couldn't find ANY pages describing how to use it,
only pages complaining about its non-existence in previous versions.
Can anyone help me here?
--
Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world:
Those who understand binary, and those who don't. 6 16493
Since date values are just doubles in disguise, you can do simple arithmetic
on them. The difference in days is just Date2 - Date1, plus one if the count
is inclusive. If the dates include time values (the decimal part) you'll
need to convert to integer first.
"Lofty" <lo***@no.spam> wrote in message
news:Ms********************@wards.force9.net... Hi all.
I have to write an app that interacts with mySQL (I really must have done some evil, evil stuff in a previous life to be landed with this!)
I need to work out the difference in days between values in the database
and the current date. "No problem," thought I , "I'll just use the SQL
DATEDIFF command." Heh! Well, the user interface I'm using didn't even recognise DATEDIFF as being a function, so I decided to visit the mySQL website.
Their description of DATEDIFF is as follows:
------------------------ DATEDIFF(ARGUMENTS) TIMEDIFF(ARGUMENTS) [Rest of description to be added here]
NEED EXAMPLE DATEDIFF() and TIMEDIFF() were added in MySQL 4.1.1. ------------------------
Wow! How helpful! I can't believe that they don't provided decent documentation for their database server!
I had a quick Google, but couldn't find ANY pages describing how to use
it, only pages complaining about its non-existence in previous versions.
Can anyone help me here?
-- Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world: Those who understand binary, and those who don't.
Since date values are just doubles in disguise, you can do simple arithmetic
on them. The difference in days is just Date2 - Date1, plus one if the count
is inclusive. If the dates include time values (the decimal part) you'll
need to convert to integer first.
"Lofty" <lo***@no.spam> wrote in message
news:Ms********************@wards.force9.net... Hi all.
I have to write an app that interacts with mySQL (I really must have done some evil, evil stuff in a previous life to be landed with this!)
I need to work out the difference in days between values in the database
and the current date. "No problem," thought I , "I'll just use the SQL
DATEDIFF command." Heh! Well, the user interface I'm using didn't even recognise DATEDIFF as being a function, so I decided to visit the mySQL website.
Their description of DATEDIFF is as follows:
------------------------ DATEDIFF(ARGUMENTS) TIMEDIFF(ARGUMENTS) [Rest of description to be added here]
NEED EXAMPLE DATEDIFF() and TIMEDIFF() were added in MySQL 4.1.1. ------------------------
Wow! How helpful! I can't believe that they don't provided decent documentation for their database server!
I had a quick Google, but couldn't find ANY pages describing how to use
it, only pages complaining about its non-existence in previous versions.
Can anyone help me here?
-- Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world: Those who understand binary, and those who don't.
Thanks for the response, Jezebel.
However, I tried your logic, and according to mySQL, December 1st 2003 -
October 15 2003 = -20030995062807
which doesn't make an awful lot of sense to me - it certainly isn't the
difference in days! ;-)
Has anyone else managed to get the fabled mySQL DATEDIFF function to work?
--
Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world:
Those who understand binary, and those who don't.
"Jezebel" <gr****@play.net> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl... Since date values are just doubles in disguise, you can do simple
arithmetic on them. The difference in days is just Date2 - Date1, plus one if the
count is inclusive. If the dates include time values (the decimal part) you'll need to convert to integer first.
"Lofty" <lo***@no.spam> wrote in message news:Ms********************@wards.force9.net... Hi all.
I have to write an app that interacts with mySQL (I really must have
done some evil, evil stuff in a previous life to be landed with this!)
I need to work out the difference in days between values in the database and the current date. "No problem," thought I , "I'll just use the SQL DATEDIFF command." Heh! Well, the user interface I'm using didn't even
recognise DATEDIFF as being a function, so I decided to visit the mySQL website.
Their description of DATEDIFF is as follows:
------------------------ DATEDIFF(ARGUMENTS) TIMEDIFF(ARGUMENTS) [Rest of description to be added here]
NEED EXAMPLE DATEDIFF() and TIMEDIFF() were added in MySQL 4.1.1. ------------------------
Wow! How helpful! I can't believe that they don't provided decent documentation for their database server!
I had a quick Google, but couldn't find ANY pages describing how to use it, only pages complaining about its non-existence in previous versions.
Can anyone help me here?
-- Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world: Those who understand binary, and those who don't.
Thanks for the response, Jezebel.
However, I tried your logic, and according to mySQL, December 1st 2003 -
October 15 2003 = -20030995062807
which doesn't make an awful lot of sense to me - it certainly isn't the
difference in days! ;-)
Has anyone else managed to get the fabled mySQL DATEDIFF function to work?
--
Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world:
Those who understand binary, and those who don't.
"Jezebel" <gr****@play.net> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl... Since date values are just doubles in disguise, you can do simple
arithmetic on them. The difference in days is just Date2 - Date1, plus one if the
count is inclusive. If the dates include time values (the decimal part) you'll need to convert to integer first.
"Lofty" <lo***@no.spam> wrote in message news:Ms********************@wards.force9.net... Hi all.
I have to write an app that interacts with mySQL (I really must have
done some evil, evil stuff in a previous life to be landed with this!)
I need to work out the difference in days between values in the database and the current date. "No problem," thought I , "I'll just use the SQL DATEDIFF command." Heh! Well, the user interface I'm using didn't even
recognise DATEDIFF as being a function, so I decided to visit the mySQL website.
Their description of DATEDIFF is as follows:
------------------------ DATEDIFF(ARGUMENTS) TIMEDIFF(ARGUMENTS) [Rest of description to be added here]
NEED EXAMPLE DATEDIFF() and TIMEDIFF() were added in MySQL 4.1.1. ------------------------
Wow! How helpful! I can't believe that they don't provided decent documentation for their database server!
I had a quick Google, but couldn't find ANY pages describing how to use it, only pages complaining about its non-existence in previous versions.
Can anyone help me here?
-- Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world: Those who understand binary, and those who don't.
Heh!
Well, I've ended up using
TO_DAYS(departure_date) - TO_DAYS(CURDATE())
which works, but seems really, really nasty!
Is there a public.mysql.sucks newsgroup anywhere? ;-)
--
Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world:
Those who understand binary, and those who don't.
"Lofty" <lo***@no.spam> wrote in message
news:1T********************@wards.force9.net... Thanks for the response, Jezebel.
However, I tried your logic, and according to mySQL, December 1st 2003 - October 15 2003 = -20030995062807
which doesn't make an awful lot of sense to me - it certainly isn't the difference in days! ;-)
Has anyone else managed to get the fabled mySQL DATEDIFF function to work?
-- Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world: Those who understand binary, and those who don't. "Jezebel" <gr****@play.net> wrote in message news:ec**************@TK2MSFTNGP12.phx.gbl... Since date values are just doubles in disguise, you can do simple arithmetic on them. The difference in days is just Date2 - Date1, plus one if the count is inclusive. If the dates include time values (the decimal part) you'll need to convert to integer first.
"Lofty" <lo***@no.spam> wrote in message news:Ms********************@wards.force9.net... Hi all.
I have to write an app that interacts with mySQL (I really must have done some evil, evil stuff in a previous life to be landed with this!)
I need to work out the difference in days between values in the
database and the current date. "No problem," thought I , "I'll just use the SQL DATEDIFF command." Heh! Well, the user interface I'm using didn't even recognise DATEDIFF as being a function, so I decided to visit the mySQL website.
Their description of DATEDIFF is as follows:
------------------------ DATEDIFF(ARGUMENTS) TIMEDIFF(ARGUMENTS) [Rest of description to be added here]
NEED EXAMPLE DATEDIFF() and TIMEDIFF() were added in MySQL 4.1.1. ------------------------
Wow! How helpful! I can't believe that they don't provided decent documentation for their database server!
I had a quick Google, but couldn't find ANY pages describing how to
use it, only pages complaining about its non-existence in previous versions.
Can anyone help me here?
-- Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world: Those who understand binary, and those who don't.
Heh!
Well, I've ended up using
TO_DAYS(departure_date) - TO_DAYS(CURDATE())
which works, but seems really, really nasty!
Is there a public.mysql.sucks newsgroup anywhere? ;-)
--
Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world:
Those who understand binary, and those who don't.
"Lofty" <lo***@no.spam> wrote in message
news:1T********************@wards.force9.net... Thanks for the response, Jezebel.
However, I tried your logic, and according to mySQL, December 1st 2003 - October 15 2003 = -20030995062807
which doesn't make an awful lot of sense to me - it certainly isn't the difference in days! ;-)
Has anyone else managed to get the fabled mySQL DATEDIFF function to work?
-- Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world: Those who understand binary, and those who don't. "Jezebel" <gr****@play.net> wrote in message news:ec**************@TK2MSFTNGP12.phx.gbl... Since date values are just doubles in disguise, you can do simple arithmetic on them. The difference in days is just Date2 - Date1, plus one if the count is inclusive. If the dates include time values (the decimal part) you'll need to convert to integer first.
"Lofty" <lo***@no.spam> wrote in message news:Ms********************@wards.force9.net... Hi all.
I have to write an app that interacts with mySQL (I really must have done some evil, evil stuff in a previous life to be landed with this!)
I need to work out the difference in days between values in the
database and the current date. "No problem," thought I , "I'll just use the SQL DATEDIFF command." Heh! Well, the user interface I'm using didn't even recognise DATEDIFF as being a function, so I decided to visit the mySQL website.
Their description of DATEDIFF is as follows:
------------------------ DATEDIFF(ARGUMENTS) TIMEDIFF(ARGUMENTS) [Rest of description to be added here]
NEED EXAMPLE DATEDIFF() and TIMEDIFF() were added in MySQL 4.1.1. ------------------------
Wow! How helpful! I can't believe that they don't provided decent documentation for their database server!
I had a quick Google, but couldn't find ANY pages describing how to
use it, only pages complaining about its non-existence in previous versions.
Can anyone help me here?
-- Lofty http://www.brainache.demon.co.uk
- There are 10 types of people in this world: Those who understand binary, and those who don't.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: CJM |
last post by:
I have an ASP page that lists files and folders in a directory. I'm using a
cookie to record the last time this page was visited, and I intend to show
links that are created/modified from that date...
|
by: inamori |
last post by:
I face that problems
07/01/2003 06/30/2006 ---------> it should be 3
01/01/2003 02/28/2005 --------->could i get 2 years and 2 months
01/01/2003 03/01/2005 ...
|
by: intl04 |
last post by:
I'm trying to set up a query that will include a new field ('Days
until completion') whose value is derived from the DateDiff function.
I think I have the syntax correct but am not sure.
Days...
|
by: Paolo |
last post by:
I am having some problem with a Year Function.
I have form on which I have 4 field which indicate dates and an
additional form which sums those dates:
These are the fields:
YEARS...
|
by: PMBragg |
last post by:
ORINGINAL Post
>Thank you in advance. I'm trying to pull all inventory items from December
>of the previous year back to 4 years for my accountant. I know this can be
>done, but I'm drawing a...
|
by: Adrian |
last post by:
I hit on this problem converting a VB.NET insurance application to C#.
Age next birthday calculated from date of birth is often needed in
insurance premium calculations.
Originally done using...
|
by: sr |
last post by:
Anyone know of a better way to simulate a datediff for C#, i.e.,
without referencing the VB.NET runtime?
Only added the functionality that was needed for me so it is not
the full implementation...
|
by: kevinjwilson |
last post by:
I am trying to get the date difference between two dates but I don't
want the function to include weekends in the calculation. Does anyone
have an idea on how to make this work?
|
by: muddasirmunir |
last post by:
i am using vb 6 , i had place two datepicker in form now i want to calcuate differcen of month in two date for this i used the function datediff
i had try it withh many syntax but getting error...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |