# Convert datetime tag into formatted string into script

**URL:** <https://forum.inductiveautomation.com/t/convert-datetime-tag-into-formatted-string-into-script/8838>\
**Category:** Ignition\
**Created:** [August 1, 2014, 1:21pm UTC](https://forum.inductiveautomation.com/t/convert-datetime-tag-into-formatted-string-into-script/8838 "2014-08-01T13:21:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarioB](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@DarioB](https://forum.inductiveautomation.com/u/DarioB)\
**Post date:** [August 1, 2014, 1:21pm UTC](https://forum.inductiveautomation.com/t/convert-datetime-tag-into-formatted-string-into-script/8838/1 "2014-08-01T13:21:53Z")

</div>

I have a datetime tag the users pick up with a calendar object.

Inside a script (defined in a script module) I wanto to convert it to format YYYYMMDD to pass as a parameter of a query to my sql server

Inside the script I get the value with system.tag.read().value

If I convert using str() I get the full string including time and timezone.

I tried with .strftime but is not working

---

<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:** [August 1, 2014, 2:24pm UTC](https://forum.inductiveautomation.com/t/convert-datetime-tag-into-formatted-string-into-script/8838/2 "2014-08-01T14:24:59Z")

</div>

Can you post what you’ve done and tell us what’s not working about it? I would have thought that time.strftime would do the job…
