What is the return type of getTagValue for DateTime tags?

This is a Global Event Script

b = java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(fpmi.tag.getTagValue("[]ExpectedTransferTime")).getTime()

Says the return value of fpmi.tag.getTagValue can’t be coerced to a string. So, what is the return type of getTagValue() then?

The return value for fpmi.tag.getTagValue for a date/time tag would be a a Date. So, if you’re trying to get the time in milliseconds since the epoch (which is what it looks like you’re trying to do), you’d simply do this:

b = fpmi.tag.getTagValue("[]ExpectedTransferTime").getTime()

Hope this helps,

When I try that, I get an exception: AttributeError: ‘int’ object has no attribute ‘getTime’

Ah, I was afraid of that. You’ve run into a bug that was reported by another user yesterday. The issue is that the tag you’re dealing with hasn’t been subscribed to (e.g. bound to) before you try to use it in scripting. This isn’t correct functionality, of course, but the workaround is to drop that tag onto a dummy label on the screen. You can even make that label invisible, if you want. Then your script will be able to fetch the tag correctly, once it has been used in a binding on an open window.

This will be fixed in 3.1.5.

Sorry for the inconvenience,

Thank you, that worked!