|
-
Jan 5th, 2001, 05:35 AM
#1
Thread Starter
Lively Member
Hi Guys,
My database has a date time stamp, heres an example.
1/5/2001 9:46:23 AM
D/M/YYYY H:MM:SS ??
I need to know the number of days/hours/mins since this date using sql. Is this possible? I can do it with Now() to find the days, but I could really do with it being a little more detailed.
Anyhelp much appreciated as always,
Paul.
Set MCP = NTServer + NTWorkstation
-
Jan 5th, 2001, 06:40 AM
#2
Fanatic Member
You could use DateDiff. You might have to return the values separately and calculate the difference.
i.e.
days = DateDiff("d", Date1, Date2)
hours = DateDiff("h", date1, Date2)-(DateDiff("d", Date1, Date2)*1440) [24 hours per day]
minutes = DateDiff("n", date1, Date2)-(DateDiff("d", Date1, Date2)*1440) [60 * 24 = 1440 minutes per day]
seconds = DateDiff("s", date1, Date2)-(DateDiff("d", Date1, Date2)*86400) [60 * 60 * 24 = 86400 seconds per day]
I am sure there must be an easier way but I cannot think of it off the top of my head!
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|