Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing or trimming or splitting a field 1

Status
Not open for further replies.

luxvivens

Technical User
May 20, 2010
27
CA
I am using CR10.

I have a string field named {ExactDateTime}
It reperesents the date and time a medication was administered.
It is 16 characters in length

Example:
2010100815163000

The first four characters represent year
Characters 5 and 6 are month
Characters 7 and 8 are day number
Characters 9 thru 12 are military time
Characters 13 and 14 are seconds
Characters 15 and 16 are both 0 and not used

I would like to create a date field to be displayed as 10/08/2010 or something similar.
I don't need the time.

I'm struggling, I'm new (not that that is an excuse). Would welcome a suggestion or a function that might help me do this.
Thanks in advance!

 
it may not be the simplest, but from my experience this is the most flexible and gives consistent results:

//{@DateExtract}
numbervar de := LEFT({ExactDateTime},8);
Date(val(left(de,4)), val(mid(de,5,2)), val(right(de,2)))
 
@medDate
date(val(left({ExactDateTime},4)),val(mid({ExactDateTime},5,2)),val(mid({ExactDateTime},7,2)))
 
Wow. Timely and right on. Very much appreciated :) Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top