I have a field for time, 24 hour format as hhmmss, that may have 5 or 6 characters based on the hour of the day. I need the hour value only in a new column. I am trying to use an IF statement in a new column to say that if LEN([CTIME]=5, then LEFT([CTIME],1) elseif LEN([CTIME]=6, then LEFT([CTIME],2). Having trouble writing the statement, any help would be appreciated
Hi,CTIME],1) elseif LEN([CTIME]=6, then LEFT([CTIME],2). Having trouble writing the statement, any help would be appreciated
Am 19.09.2020 um 22:42 schrieb Scott Sabo:
I have a field for time, 24 hour format as hhmmss, that may have 5 or 6 characters based on the hour of the day. I need the hour value only in a new column. I am trying to use an IF statement in a new column to say that if LEN([CTIME]=5, then LEFT([
The format of a field is usually uninteresting, because it only concernsHello, this does not work as it is a numeric string, either 65215 which would mean 6:52:15 AM or 185215 which would mean 6:52:15 PM. Since it is just a 5 or 6 digit numeric string I am working with, I an just trying to grab the first character (if 5
the representation. If the field is of type Date, the Hour(myTime)
function can be used to determine the hour.
Ulrich
On Saturday, September 19, 2020 at 4:01:32 PM UTC-7, Ulrich Möller wrote:
Hi,Hello, this does not work as it is a numeric string, either 65215 which would mean 6:52:15 AM or 185215 which would mean 6:52:15 PM. Since it is just a 5 or 6 digit numeric string I am working with, I an just trying to grab the first character (if 5 digit) or first two if a 6 digit string.
Am 19.09.2020 um 22:42 schrieb Scott Sabo:
I have a field for time, 24 hour format as hhmmss, that may have 5 or 6The format of a field is usually uninteresting, because it only concerns
characters based on the hour of the day. I need the hour value only in a >>> new column. I am trying to use an IF statement in a new column to say that >>> if LEN([CTIME]=5, then LEFT([CTIME],1) elseif LEN([CTIME]=6, then
LEFT([CTIME],2). Having trouble writing the statement, any help would be >>> appreciated
the representation. If the field is of type Date, the Hour(myTime)
function can be used to determine the hour.
Ulrich
I have a field for time, 24 hour format as hhmmss, that may have 5 or 6 characters based on the hour of the day. I need the hour value only in a new column. I am trying to use an IF statement in a new column to say that if LEN([CTIME]=5, then LEFT([CTIME],1) elseif LEN([CTIME]=6, then LEFT([CTIME],2). Having trouble writing the statement, any help would be appreciated
Hi Scott,Mike, this worked great! I did find a few instances though in my table where I have a 4 digit number, just minutes and seconds because the record created between midnight and 1 AM. Any idea how to account for these in the code above and return an hour
You could use Left$(CTIME,Len(CTIME)\3).
The backward slash has to be used as the divide operator to give an integer result; 6\3=2, 5\3=1.
Mike P.
20/9/20
On Sunday, September 20, 2020 at 2:45:43 AM UTC-7, Mike P wrote:value of zero?
Hi Scott,
You could use Left$(CTIME,Len(CTIME)\3).
The backward slash has to be used as the divide operator to give an integer result; 6\3=2, 5\3=1.
Mike P.Mike, this worked great! I did find a few instances though in my table where I have a 4 digit number, just minutes and seconds because the record created between midnight and 1 AM. Any idea how to account for these in the code above and return an hour
20/9/20
On Sunday, September 20, 2020 at 2:45:43 AM UTC-7, Mike P wrote:value of zero?
Hi Scott,Mike, this worked great! I did find a few instances though in my table where I have a 4 digit number, just minutes and seconds because the record created between midnight and 1 AM. Any idea how to account for these in the code above and return an hour
You could use Left$(CTIME,Len(CTIME)\3).
The backward slash has to be used as the divide operator to give an integer result; 6\3=2, 5\3=1.
Mike P.
20/9/20
On Saturday, September 19, 2020 at 4:01:32 PM UTC-7, Ulrich Möller wrote:CTIME],1) elseif LEN([CTIME]=6, then LEFT([CTIME],2). Having trouble writing the statement, any help would be appreciated
Hi,
Am 19.09.2020 um 22:42 schrieb Scott Sabo:
I have a field for time, 24 hour format as hhmmss, that may have 5 or 6 characters based on the hour of the day. I need the hour value only in a new column. I am trying to use an IF statement in a new column to say that if LEN([CTIME]=5, then LEFT([
digit) or first two if a 6 digit string.The format of a field is usually uninteresting, because it only concernsHello, this does not work as it is a numeric string, either 65215 which would mean 6:52:15 AM or 185215 which would mean 6:52:15 PM. Since it is just a 5 or 6 digit numeric string I am working with, I an just trying to grab the first character (if 5
the representation. If the field is of type Date, the Hour(myTime)
function can be used to determine the hour.
Ulrich
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 39:09:24 |
Calls: | 6,648 |
Files: | 12,193 |
Messages: | 5,329,314 |