?
Solved

URGENT! MS ACCESS! Querying a Date/Time Field - Need ASAP!

Posted on 2006-07-14
6
Medium Priority
?
158 Views
Last Modified: 2013-12-24
I have a field saved as

7/6/2006 9:00:00 AM

but when I dump the var I get

2006-07-06 09:00:00.0

I need the time as well! Very Critical!

Initial Query
         <cfquery datasource="#Request.App.DS#" name="GetEvent">
         SELECT EventID,
                EventTypeID,
                EventName,
                StartDateTime,
                EndDateTime,
                EventShortDesc,
                EventDescription,
                Location,
                EventURL,
                EventImage,
                ContactName,
                ContactPhone,
                ContactEmail,
                AllDayFlag
           FROM Event
          WHERE EventID = #URL.EventID#
         </cfquery>

I know you can do this via Oracle...I need it for access...
                TO_DATE(TO_CHAR(StartDateTime, 'MM/DD/YYYY HH24:MI'), 'MM/DD/YYYY HH24:MI') AS StartDateTime,
                TO_DATE(TO_CHAR(EndDateTime, 'MM/DD/YYYY HH24:MI'), 'MM/DD/YYYY HH24:MI') AS EndDateTime,






0
Comment
Question by:firstbankak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 15

Expert Comment

by:danrosenthal
ID: 17111125
<CFOUTPUT>
StartDateTime:
#dateformat(GetEvent.StartDateTime,"MM/DD/YYYY")# #timeformat(GetEvent.StartDateTime,"HH:mm")#
<BR>

EndDateTime:
#dateformat(GetEvent.EndDateTime,"MM/DD/YYYY")# #timeformat(GetEvent.EndDateTime,"HH:mm")#
</CFOUTPUT>
0
 
LVL 12

Expert Comment

by:mkishline
ID: 17111162
You should be able to do either:

<cfquery datasource="#Request.App.DS#" name="GetEvent">
         SELECT EventID,
                EventTypeID,
                EventName,
                Format(StartDateTime,"mm/dd/yyyy hh:nn") AS StartDateTime,
                Format(EndDateTime,"mm/dd/yyyy hh:nn") AS EndDateTime,
                EventShortDesc,
                EventDescription,
                Location,
                EventURL,
                EventImage,
                ContactName,
                ContactPhone,
                ContactEmail,
                AllDayFlag
           FROM Event
          WHERE EventID = #URL.EventID#
         </cfquery>

And if that doesn't work, you can always do it when you return the values:
<cfoutput query="GetEvent">
   Start Date: #DateFormat(StartDateTime,"mm/dd/yyyy")# #TimeFormat(StartDateTime,"hh:mm")#
   End Date: #DateFormat(EndDateTime,"mm/dd/yyyy")# #TimeFormat(EndDateTime,"hh:mm")#
</cfoutput>
0
 
LVL 12

Expert Comment

by:mkishline
ID: 17111211
Sorry dan, didn't mean to duplicate your stellar advice ;-)
0
 
LVL 12

Accepted Solution

by:
mkishline earned 2000 total points
ID: 17406789
It seems as though both dan and myself offered solutions that would solve firstbankak's problem. Either a point split here (or points to dan if my sql solution wasn't clear enough, since he was faster on the draw) seems most appropriate.

Thanks,
mkishline
0
 

Author Comment

by:firstbankak
ID: 17408001
Please close this question.  The individual who initiated it with me is no longer employed here.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question