Reputation:
I am implementing a project using the OSA-CBM 3.3 standard. Within that standard, there includes a type called Osacbmtime
. I am attempting to parse a DateTime
value from type Osacbmtime
. Casting doesn't seem to get the job done. Is there a useful (or obvious) approach I can take to accomplish this?
Upvotes: 0
Views: 119
Reputation: 1504182
Given this snippet from some Java code (virtual the only reference I could find):
DMPort d = new DMPort();
d.lastUpdate = new OsacbmTime();
d.lastUpdate.time = "2007-08-15T16:23:09";
d.lastUpdate.time_type = OsacbmTimeType.OSACBM_TIME_MIMOSA;
I suspect you want something like:
DateTime date = DateTime.ParseExact(time.Time, "s",
CultureInfo.InvariantCulture,
DateTimeStyles.AssumeLocal);
Where s
is the format specifier for the sortable 8601 format.
Upvotes: 1
Reputation: 17139
Osacbmtime
must be a custom library, because Google searches for it yield nothing.
Your best bet, with what little information you have provided about the Osacbmtime
type, is to see if it is possible to output it in a date/time format, then parse it into a DateTime object, i.e.
DateTime myDT = DateTime.Parse(myOSACBMTime.ToString("MM/DD/YYYY HH:MM:SS AA"));
Obviously this is pseudocode since I don't have the documentation for Osacbmtime
, but (hopefully) you get the general idea.
Upvotes: 1