A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DatePart



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2010, 07:04 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default DatePart

Keith wrote:

I'm trying to convert "mm/dd/yyyy hh:nn:ss" date format to just time using
DatePart function.

I've used DatePart("hh:nn",[TimeIn]) and it returns "Error".

I've used TEMP: DatePart("h",[TimeIn]) & ":" & DatePart("n",[TimeIn]) and it
returns the time; however, I can't compare the result to other time since it
returns the results in text format.


That would be a complicated way to get the time part of a
date/time value. Try using the TimeValue function instead.

--
Marsh
MVP [MS Access]
  #2  
Old June 4th, 2010, 07:31 PM posted to microsoft.public.access.queries
Keith
external usenet poster
 
Posts: 531
Default DatePart

I'm trying to convert "mm/dd/yyyy hh:nn:ss" date format to just time using
DatePart function.

I've used DatePart("hh:nn",[TimeIn]) and it returns "Error".

I've used TEMP: DatePart("h",[TimeIn]) & ":" & DatePart("n",[TimeIn]) and it
returns the time; however, I can't compare the result to other time since it
returns the results in text format.

Any suggestions?


Keith
  #3  
Old June 4th, 2010, 09:03 PM posted to microsoft.public.access.queries
Keith
external usenet poster
 
Posts: 531
Default DatePart

Using the TimeValue worked perfectly!

Thank you Marshall.


Keith

"Marshall Barton" wrote:

Keith wrote:

I'm trying to convert "mm/dd/yyyy hh:nn:ss" date format to just time using
DatePart function.

I've used DatePart("hh:nn",[TimeIn]) and it returns "Error".

I've used TEMP: DatePart("h",[TimeIn]) & ":" & DatePart("n",[TimeIn]) and it
returns the time; however, I can't compare the result to other time since it
returns the results in text format.


That would be a complicated way to get the time part of a
date/time value. Try using the TimeValue function instead.

--
Marsh
MVP [MS Access]
.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.