LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

use a date to generate a timestamp

Solved!
Go to solution

I want to write an app that processes dates from string format and will give me a timestamp.

Explantion of use:

I have an array of dates (of birth), and I want to find out how old each person is at a given point in time (denoted by a timestamp constant).

Or has anyone got a better solution for caculating age from an array of strings and another input of type undefined. (age output is numeric.

 

Can anyone point me in the right direction to start please.

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 1 of 6
(3,173 Views)
This VI shows how to do most of what you are looking for. You will probably have to change it for your specific situatuion.
Tim
GHSP
Message 2 of 6
(3,161 Views)
You could simply convert each string element to a timestamp and do your subtraction that way. However, the method shown above to get a timestamp is the convoluted way of doing it. A far easier way to do it is as shown below (note that the dates will be the same. If your strings have time information, then you can include that as well in the format string.
Message 3 of 6
(3,135 Views)
I gave him the rest of the VI to show how it could be done and all of the parts required. I knew that there was an easier way to do this.
Tim
GHSP
0 Kudos
Message 4 of 6
(3,114 Views)

aeastet wrote:
I gave him the rest of the VI to show how it could be done and all of the parts required. I knew that there was an easier way to do this.

<Scratches head> Then if you knew there was a far easier way, why did you show such a convoluted approach? That would simply confuse someone who's new to LabVIEW. 

0 Kudos
Message 5 of 6
(3,106 Views)
Solution
Accepted by topic author James_W

Thanks to both of you for pointing me in that direction.

I have worked out how to do what I wanted and posted it back here as an explanation.

The VI takes a date input in the defined format (could come from a timestamp date string, or a database etc) and calculates the age of the person at the dat provided using the DOB provided. (I have not bothered to debug this yet so no nasty comments about error trapping and habdling people who are not yet born thank you!!)

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 6 of 6
(3,069 Views)