Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Seperate time from dateTime column in microsoft access

Posted on 2004-08-17
4
Medium Priority
?
270 Views
Last Modified: 2008-03-10
Hi,
I am working on vb.net for windows form and ms access is as backend database.
I am query datatime field from access and show that on dataGrid on form, but I just want to show the time on datagrid and not the whole date and time. How can I make a query so that it retrieve only time part , and not the whole thing. I want to do that in query to access database so that i dont have to do anything on vb.net coding side.
How is it possible? please help.
0
Comment
Question by:greatroni
[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
  • 2
4 Comments
 
LVL 7

Expert Comment

by:rockmuncher
ID: 11827218
to get the date component in a query use

   mydate: clng(datefield())  ' returns a long integer value
or
   mydate: format(clng(datefield()),"Short Date") ' returns text in short date format, or any other format you choose to use  


to get the time component in a query use

   mydate: datefield-clng(datefield())  ' returns a double value
or
   mydate: format(clng(datefield()),"HH:MM:SS") ' returns text in HH:MM:SS format, or any other format you choose to use  
0
 
LVL 7

Expert Comment

by:rockmuncher
ID: 11827224
oops, let me try that again

to get the date component in a query use

   mydate: clng(datefield)  ' returns a long integer value
or
   mydate: format(clng(datefield),"Short Date") ' returns text in short date format, or any other format you choose to use  


to get the time component in a query use

   mydate: datefield-clng(datefield)  ' returns a double value
or
   mydate: format(datefield-clng(datefield),"HH:MM:SS") ' returns text in HH:MM:SS format, or any other format you choose to use  
 
 
change 'datefield' to the name of the field you are concerned about in the query.
 
   
 
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 11827243
you can just use

 yourtime:Format(datefield,"hh:nn:ss")      'this will give you the time
0
 

Author Comment

by:greatroni
ID: 11827296
Thank you so much for this.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

636 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