Jump to content

Scan String Date Function into Date & Time Array


alukindo

Recommended Posts

Can anyone care to provide a fast method to scan the Date & Time string in column # 3 in the attached VI into a 1-D array of LabVIEW Date & Time data type?

I have several methods to do this but I think that there must be a much faster one out there.

Maybe it would be helpful for you to post up your methods (that you mention above) too?

Quick question: How important is performance to your use case? (given, that you have already have an implementation(s) to parse the data and solve the problem?)

Link to comment

Hi:

I am passing the array into a for Loop and then parsing the 3rd element to get the 3 characters for month #, I then convert the date and time into LabVIEW time.

Performance is really important because the array I work with has 50,000+ element. The sad thing is that this data is read from a text file in < than 2 seconds and thereafter a large chunk of time is used to convert that date string column into a calender number that can be computed.

Regards

Anthony L.

Link to comment

Hi:

I am passing the array into a for Loop and then parsing the 3rd element to get the 3 characters for month #, I then convert the date and time into LabVIEW time.

Performance is really important because the array I work with has 50,000+ element. The sad thing is that this data is read from a text file in < than 2 seconds and thereafter a large chunk of time is used to convert that date string column into a calender number that can be computed.

Regards

Anthony L.

You can use scan from string to get your data as a timestamp.

Ton

Link to comment

Yes, I thought about that, but how about when the abbrev for month name changes from say Jul to a Aug? Or perhaps are you suggesting catching the scan error and incrementing the month name until no error is encountered?

Regards

Anthony

Here's the formatter for the time format. %b will match the abbreviated month name, this string is locale dependent on dutch system May isn't recognized but Mei is. So if your locale settings is different than the file format you will have a problem.

Another option is to replace every month string with a number (Jan -> 1)

EDIT:

the following code will get the date: %<%d%b%y>T expand it to get the time as well.

Ton

Link to comment

Ton P

Your format date message arrived after I had posted the above example showing how parsing is done now. I could not figure out a way to scan using your date specifiers. Any help will be greatly appreciated

Add a '%d - ' before the previous format string, to get two outputs: one with the number, and one with the timestamp.

Ton

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.