# Cant Read FormatString Value of Client Date Tag

**URL:** <https://forum.inductiveautomation.com/t/cant-read-formatstring-value-of-client-date-tag/15995>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [November 14, 2017, 5:59pm UTC](https://forum.inductiveautomation.com/t/cant-read-formatstring-value-of-client-date-tag/15995 "2017-11-14T17:59:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShazamThat](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@ShazamThat](https://forum.inductiveautomation.com/u/ShazamThat)\
**Post date:** [November 14, 2017, 5:59pm UTC](https://forum.inductiveautomation.com/t/cant-read-formatstring-value-of-client-date-tag/15995/1 "2017-11-14T17:59:16Z")

</div>

Hello everyone,

I’m trying to print the startDate value below:

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6979bcac550b49c13f770336d8665a92b729cde8.png)

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?

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [November 14, 2017, 7:54pm UTC](https://forum.inductiveautomation.com/t/cant-read-formatstring-value-of-client-date-tag/15995/2 "2017-11-14T19:54:03Z")

</div>

Put single quotes around your ‘%20’

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f81ce477035f12154eb18e07ab5b234894efe54f.png)

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [November 14, 2017, 7:55pm UTC](https://forum.inductiveautomation.com/t/cant-read-formatstring-value-of-client-date-tag/15995/3 "2017-11-14T19:55:06Z")

</div>

> [@ShazamThat](#):
>
> 11/10/2017%2012:00:00.

Where formatString = the value of startDate.FormatString

```auto
import urllib2
print urllib2.unquote(formatString)

```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 14, 2017, 7:59pm UTC](https://forum.inductiveautomation.com/t/cant-read-formatstring-value-of-client-date-tag/15995/4 "2017-11-14T19:59:56Z")

</div>

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 java.util.date 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.

```auto
from java.text import SimpleDateFormat as SDF

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

formattedDate = dateFormat.format(startDate)

print formattedDate

```

---

<div class="post-metadata">

**Author:** ![ShazamThat](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@ShazamThat](https://forum.inductiveautomation.com/u/ShazamThat)\
**Post date:** [November 16, 2017, 4:19pm UTC](https://forum.inductiveautomation.com/t/cant-read-formatstring-value-of-client-date-tag/15995/5 "2017-11-16T16:19:37Z")

</div>

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

> startDate = system.date.format(system.tag.read("[Client]Castings/startDate").value,'MM/dd/yyyy%20HH:mm:ss')

Thanks for the help!
