473,496 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

format date time in Access / ASP

13 New Member
I have created a query using Microsoft access that will work out the difference between a time that i enter into the database (HH:MM:SS) and then to take away the current time.

I have this working inside the access database but i cannot take it from the database and display the result in my webpage.

The SQL query i get after creating my query in access is:

Expand|Select|Wrap|Line Numbers
  1. SELECT Flights.Depart_Time, Time() AS [Current_Time], IIf([Depart_time]>Time(),"Will Depart In","Should Have Left") AS SStatus, FormatDateTime([Depart_time]-Time()) AS How_Long, Flights.Airline, Flights.Flight_Number, Flights.Status, Flights.Location
  2. FROM Flights
  3. ORDER BY Flights.Depart_Time;
The error that i have previously had is FormatDateTime

Can anybody help?

Thanks in advance

Matthew
Feb 22 '08 #1
3 2863
DrBunchman
979 Recognized Expert Contributor
Hi Matthew,

What actually happens when you load the page? Can you show us your code which connects to the db & runs the query and the error message that is produced please.

Thanks,

Dr B
Feb 22 '08 #2
mtgriffiths86
13 New Member
Hi,

The error that i am getting is:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Undefined function 'FormatDateTime' in expression.
/assign3/Departures.asp, line 46

Line 46 has the code:

Expand|Select|Wrap|Line Numbers
  1. objRecordset.Open "SELECT * FROM Flights_Query ORDER BY Depart_Time ASC",objConnection
The field that i am trying to display is How_Long.

Hope this is what you need.

Thanks again
Feb 23 '08 #3
jagged
23 New Member
Hi,

The error that i am getting is:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Undefined function 'FormatDateTime' in expression.
/assign3/Departures.asp, line 46

Line 46 has the code:

Expand|Select|Wrap|Line Numbers
  1. objRecordset.Open "SELECT * FROM Flights_Query ORDER BY Depart_Time ASC",objConnection
The field that i am trying to display is How_Long.

Hope this is what you need.

Thanks again

I dont think FormatDateTime is a valid function access SQL.

Try something like Format(depart_time - Time(), "HH:MM")
Feb 23 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7139
by: Shaiboy_UK | last post by:
Hi All, Sorry if this is the wrong newsgroup to post into, on this topic, if so, please point me in the right direction..... Currently working on a ASP for a friend, which requires the date...
8
2233
by: Ishbel Kargar | last post by:
Since upgrading from old laptop (Windows 98) to new laptop (Windows XP), my mail-merge letters are doing strange things with date formats. For instance, my reminder letter for lapsed subs carries...
1
3395
by: Bruce Cushman | last post by:
My DB is Access 2000 based "possibly written in 2002" and I have to send and receive update files, ported to a UNIX server by FTP, DB unknown. The file content uses a fixed length string, zero...
4
4469
by: Tony | last post by:
Hey guys, I use Google Groups quite a bit as it is an enormous wealth of information, and now I need some help. I have created a query using parameters to capture a range of date, the date is...
5
816
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
1
2046
by: scott | last post by:
Hi Everyone, I don't know if this is the correct forum but I thought i'd ask. I have an access DB with a function to automatically safe a table with fields i'm mail merging into MS Word. Word...
5
4907
by: Takeadoe | last post by:
Gang - I'm generating date and time variables from scanned forms. Currently, the date and time values are as follows: 06/26/2006 and 11:30 AM. I've written VBA code to combine them into a...
0
2486
by: Wayne | last post by:
I am charting data from a query that consists of a Date/Time field and a Number field. The Date/Time field is the x scale on my chart. Sometimes data is collected from different times during the...
10
5786
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
9
2902
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
0
7120
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6991
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...
0
7160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7373
tracyyun
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...
0
5456
agi2029
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,...
1
4897
isladogs
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...
0
4583
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...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.