How i select the hours only in date feild of yyyymmddhhmmss

H

HaywireMermaid

I have an application that returns a date/time feild in the format
yyyymmddhhmmss nubmber only string, i am looking for a query that will return
only the hh section. i am using access 2000 and am unable to get the
application to return a date in a more usable format.
 
J

Josh Nankivel via AccessMonster.com

I've used mid for this in the past.

For yyyymmddhhmmss

mid([FieldName],9,2)

will yield hh

9 is the starting character to extract
2 is the number of characters you want
 
J

John Vinson

I have an application that returns a date/time feild in the format
yyyymmddhhmmss nubmber only string, i am looking for a query that will return
only the hh section. i am using access 2000 and am unable to get the
application to return a date in a more usable format.

You can migrate this mess to a true Date/Time field with an
expression:

CDate(Format([datestring], "@@@@/@@/@@ @@:mad:@:mad:@"))

and then use the numerous Access date/time functions to extract
Hour(), Day(), Month() etc.

John W. Vinson[MVP]
 
Top