separating Date and Time

  • Thread starter Thread starter Welthey
  • Start date Start date
W

Welthey

I need to separate a datetime field and just show date. I've seen the posts
regarding TimeValue but I'm not having any luck with this.

The field is set up as a text field and the data looks like this :
11/30/1999 2:17:52 PM

I've used this in my query :

Mod Action Time : TimeValue(Mid([ACTIONTIME],9,2) & ":" &
Mid([ACTIONTIME],11,2))

where mod action time is a new blank field and ACTIONTIME is the existing
text field described above. Please help.

Thank you,

Welthey
 
On Tue, 22 Jan 2008 17:40:05 -0800, Welthey

Use the Format function:
format(#11/30/1999 2:17:52 PM#,"mm/dd/yyyy")
=> 11/30/1999

-Tom.
 
I need to separate a datetime field and just show date. I've seen the posts
regarding TimeValue but I'm not having any luck with this.

The field is set up as a text field and the data looks like this :
11/30/1999 2:17:52 PM

I've used this in my query :

Mod Action Time : TimeValue(Mid([ACTIONTIME],9,2) & ":" &
Mid([ACTIONTIME],11,2))

where mod action time is a new blank field and ACTIONTIME is the existing
text field described above. Please help.

Thank you,

Welthey


You're making it too hard. From the Immediate window:

?datevalue("11/30/1999 2:17:52 PM")
11/30/1999
?timevalue("11/30/1999 2:17:52 PM")
2:17:52 PM

Just use TimeValue([ACTIONTIME]) or DateValue([ACTIONTIME]) as needed.

John W. Vinson [MVP]
 
Back
Top