Converting a string-type date into a DateTime-type one.

Question

The tag’s timestamp information are available in discrete strings (one field for date, one for hour, and so on). How can I  convert this timestamp into DateTime value, with a milliseconds precision, and use this resulting timestamp elsewhere?

Solution

To do so, create a script similar to the one below. Remember that VBScript’s CDate command has no milliseconds precision, so you will need to convert the milliseconds separately and then add this value to the previous one.

To visualize a DateTime variable with milliseconds precision in a display, it will have to be formatted as: “dd/MM/yyyy HH:mm:ss.000

Attachements:

Str2date.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *