I'm trying to parse a date+time but without success.
a = "11/9/2012 8:58:19 AM";
b = Parse Date(a, "d/m/y h:m:s"); // Returns "."
Is there a way to parse a date+time like this?
Not sure why you are having trouble. In 10.0.1 if I run your script with a "show()" added:
b = Parse Date(a, "d/m/y h:m:s");
show(a, b)
I get this in the Log:
b = 11Sep2012:08:58:19;
Michael
It could depend on your locale. Are you outside of the US?
This might work better for you:
c = informat(a, "d/m/y h:m:s");
Interesting
If the datetime is in the form 11SEP2012 8:58:19 AM then this works perfectly
data x;
a="11SEP2012 8:58:19 AM";
b=input(a,datetime24.);
format b datetime19.;
put b=;
run;
But if the datepart is formatted with /'s 11/9/2012 it falls apart!
Chris: is that JMP or SAS code? The question was regarding JMP.
I'm indeed outside US, but I don't understand why that would effect parsing of dates in this way.
With informat(a, "d/m/y h:m:s"); the results are the same (I think that informat and parse date are equivalent?)
b = .;
c = .;
My JMP Pro version is 9.0.3
Check out this link:
You may need to replace the slashes with dashes or periods as mentioned by MS in this discussion.