# Convert a string metric dimension from SQL extension to timestamp

**URL:** <https://community.dynatrace.com/t/convert-a-string-metric-dimension-from-sql-extension-to-timestamp/47420>\
**Category:** Open Q&A\
**Tags:** dynatrace-managed, latest-dynatrace\
**Created:** [August 30, 2024, 7:41pm UTC](https://community.dynatrace.com/t/convert-a-string-metric-dimension-from-sql-extension-to-timestamp/47420 "2024-08-30T19:41:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![susmita\_k](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@susmita\_k](https://community.dynatrace.com/u/susmita_k)\
**Post date:** [August 30, 2024, 7:41pm UTC](https://community.dynatrace.com/t/convert-a-string-metric-dimension-from-sql-extension-to-timestamp/47420/1 "2024-08-30T19:41:58Z")

</div>

I have metric dimension, start\_time coming from SQL extension which is a string, format is&nbsp;&nbsp; ‘mm/dd/yyyy hh24:mi:ss’. I need to convert it to timestamp and then get the duration from the current time to identify if the job is running long. Could anyone please help how can I convert this string to timestamp ? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![DavidRitter](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/davidritter/32/10328_2.png) [@DavidRitter](https://community.dynatrace.com/u/DavidRitter)\
**Post date:** [September 17, 2024, 7:11pm UTC](https://community.dynatrace.com/t/convert-a-string-metric-dimension-from-sql-extension-to-timestamp/47420/2 "2024-09-17T19:11:34Z")

</div>

Have you tried using the [toTimestamp()](https://docs.dynatrace.com/docs/shortlink/conversion-and-casting-functions#toTimestamp)&nbsp;DQL function? It should meet your needs.

---

<div class="post-metadata">

**Author:** ![susmita\_k](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@susmita\_k](https://community.dynatrace.com/u/susmita_k)\
**Post date:** [September 20, 2024, 5:04pm UTC](https://community.dynatrace.com/t/convert-a-string-metric-dimension-from-sql-extension-to-timestamp/47420/3 "2024-09-20T17:04:03Z")

</div>

Yes, thats what I have used and it solved the problem 🙂
