Cant Read FormatString Value of Client Date Tag

Hello everyone,

I’m trying to print the startDate value below:

But I end up getting: Fri Nov 10 00:00:00 PST 2017

Instead of the value 11/10/2017%2012:00:00.

What’s going on and how do i get the value that is formatted according to the FormatString?

Put single quotes around your ‘%20’

Where formatString = the value of startDate.FormatString

import urllib2
print urllib2.unquote(formatString)

Reading carefully, I’m assuming you need a DateTime string formatted using the FormatString of the tag. Reading the value of a DateTime tag gives a instead of a formatted string. So, you would also need to read the value of the FormatString attribute, and format the value to that within your script.

from java.text import SimpleDateFormat as SDF

startDate ='[Client]startDate').value
dateFormat = SDF('[Client]startDate.FormatString').value)

formattedDate = dateFormat.format(startDate)

print formattedDate

1 Like

I ended up solving it by using this snipped of code instead:

startDate ="[Client]Castings/startDate").value,‘MM/dd/yyyy%20HH:mm:ss’)

Thanks for the help!