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(ARGUME NTS)
TIMEDIFF(ARGUME NTS)
[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 16510
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.spa m> wrote in message
news:Ms******** ************@wa rds.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(ARGUME NTS) TIMEDIFF(ARGUME NTS) [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.spa m> wrote in message
news:Ms******** ************@wa rds.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(ARGUME NTS) TIMEDIFF(ARGUME NTS) [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.ne t> wrote in message
news:ec******** ******@TK2MSFTN GP12.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.spa m> wrote in message news:Ms******** ************@wa rds.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(ARGUME NTS) TIMEDIFF(ARGUME NTS) [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.ne t> wrote in message
news:ec******** ******@TK2MSFTN GP12.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.spa m> wrote in message news:Ms******** ************@wa rds.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(ARGUME NTS) TIMEDIFF(ARGUME NTS) [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(departu re_date) - TO_DAYS(CURDATE ())
which works, but seems really, really nasty!
Is there a public.mysql.su cks 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.spa m> wrote in message
news:1T******** ************@wa rds.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.ne t> wrote in message news:ec******** ******@TK2MSFTN GP12.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.spa m> wrote in message news:Ms******** ************@wa rds.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(ARGUME NTS) TIMEDIFF(ARGUME NTS) [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(departu re_date) - TO_DAYS(CURDATE ())
which works, but seems really, really nasty!
Is there a public.mysql.su cks 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.spa m> wrote in message
news:1T******** ************@wa rds.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.ne t> wrote in message news:ec******** ******@TK2MSFTN GP12.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.spa m> wrote in message news:Ms******** ************@wa rds.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(ARGUME NTS) TIMEDIFF(ARGUME NTS) [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 minus 30mins to the
present... eg effectively new and modified files:
If DateDiff("n", subfolder.DateLastModified, sLastVisit ) < 30 Then.... etc
On my test machine this mechanism works OK, but on the live server (Win2k,
IIS5) I get some...
|
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 --------->could i get 2 years and 2 months and 1
|
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 until completion: DateDiff("d",,)
is TODAY the appropriate syntax for today's date? Could the
function/expression even be set up that way, or do I need to do
something else to get 'days until completion'? (My Access manuals do
not mention a TODAY...
|
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
STARTINGDATE1
ENDINGDATE1
STARTINGDATE2
|
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 blank. I've tried;
>
>DateDiff("y",-4,DateIn) and get errors
>
>Please any assistance would be greatly appreciated.
>
| |
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 DateDiff in VB.NET which is only available in C#
if you don't mind linking in Microsoft.VisualBasic.dll to your C#
application.
I wanted to avoid this so set about a pure C# solution which uses a
combination of TimeSpan in whole days and the...
|
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 of the DateDiff in the VB.NET runtime.
private int DateDiff( string Interval, DateTime Date1, DateTime Date2 )
{
int intDateDiff = 0;
TimeSpan time = Date1 - Date2;
|
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 like
datediff(mm,date1,date2)
datediff(mmm,date1,date2)
datediff(month,date1,date2)
datediff("mm",date1,date2)
datediff("mmm",date1,date2)
datediff("month",date1,date2)
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |