I was sent data in string format which looks like the following:
4/15/2017 8:30:00 AM
6/17/2017 10:31:00 AM
10/30/2017 8:35:00 AM
The AM/PM indicator, seconds indicator and minutes indicator are all in the same position of the string variable. Hours may be either 1 or 2 digits, year is consistently 4 digits but not in consistent columns of the full string variable, months and days may be either 1 or two digits. I know there are string functions that would let me extract data from specific locations in the string. And I'm pretty sure I could eventually write code with conditionals that would extract all of the relevant information. But there are lots of variables like this and this seems like a really kludgy approach. I'm not finding any date/time or string functions that would convert a string variable like this to a numerical variable. Anyone know of a simpler and less error prone strategy? Thanks.
4/15/2017 8:30:00 AM
6/17/2017 10:31:00 AM
10/30/2017 8:35:00 AM
The AM/PM indicator, seconds indicator and minutes indicator are all in the same position of the string variable. Hours may be either 1 or 2 digits, year is consistently 4 digits but not in consistent columns of the full string variable, months and days may be either 1 or two digits. I know there are string functions that would let me extract data from specific locations in the string. And I'm pretty sure I could eventually write code with conditionals that would extract all of the relevant information. But there are lots of variables like this and this seems like a really kludgy approach. I'm not finding any date/time or string functions that would convert a string variable like this to a numerical variable. Anyone know of a simpler and less error prone strategy? Thanks.
Comment