<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Timestamp in pre-execution script for HTPP monitors in Synthetic Monitoring</title>
    <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Timestamp-in-pre-execution-script-for-HTPP-monitors/m-p/118475#M369</link>
    <description>&lt;P&gt;I am posting data points in pre-execution script and dont know how to create timestamp, trying &lt;STRONG&gt;Date.parse(api.date()&lt;/STRONG&gt;) below, What's the correct way to do this ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;requestBody={&lt;BR /&gt;"type": "LB",&lt;BR /&gt;"series": [&lt;BR /&gt;{&lt;BR /&gt;"timeseriesId": "custom:alteon.CurrSessions",&lt;BR /&gt;"dimensions": {&lt;BR /&gt;"CUSTOM_DEVICE": "Load Balancers"&lt;BR /&gt;},&lt;BR /&gt;"dataPoints": [&lt;BR /&gt;[&lt;BR /&gt;Date.parse(api.date()),&lt;BR /&gt;api.randomNextInt()&lt;BR /&gt;]&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;};&lt;BR /&gt;request.setBody(requestBody);&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Nov 2020 12:15:47 GMT</pubDate>
    <dc:creator>iromaniuk</dc:creator>
    <dc:date>2020-11-03T12:15:47Z</dc:date>
    <item>
      <title>Timestamp in pre-execution script for HTPP monitors</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Timestamp-in-pre-execution-script-for-HTPP-monitors/m-p/118475#M369</link>
      <description>&lt;P&gt;I am posting data points in pre-execution script and dont know how to create timestamp, trying &lt;STRONG&gt;Date.parse(api.date()&lt;/STRONG&gt;) below, What's the correct way to do this ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;requestBody={&lt;BR /&gt;"type": "LB",&lt;BR /&gt;"series": [&lt;BR /&gt;{&lt;BR /&gt;"timeseriesId": "custom:alteon.CurrSessions",&lt;BR /&gt;"dimensions": {&lt;BR /&gt;"CUSTOM_DEVICE": "Load Balancers"&lt;BR /&gt;},&lt;BR /&gt;"dataPoints": [&lt;BR /&gt;[&lt;BR /&gt;Date.parse(api.date()),&lt;BR /&gt;api.randomNextInt()&lt;BR /&gt;]&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;};&lt;BR /&gt;request.setBody(requestBody);&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Nov 2020 12:15:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Timestamp-in-pre-execution-script-for-HTPP-monitors/m-p/118475#M369</guid>
      <dc:creator>iromaniuk</dc:creator>
      <dc:date>2020-11-03T12:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp in pre-execution script for HTPP monitors</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Timestamp-in-pre-execution-script-for-HTPP-monitors/m-p/118476#M370</link>
      <description>&lt;P&gt;I would use a variable and get the value before you start to create the requestBody. Something like this:&lt;BR /&gt;&lt;BR /&gt;var timestampNow = api.date();&lt;/P&gt;&lt;P&gt;and then use the variable later. Or if you need it to be in a specific format you can use api.dateToFormat. You can find a couple of examples &lt;A rel="noopener noreferrer" href="https://www.dynatrace.com/support/help/shortlink/http-monitor-pre-post-script#date-formatting" target="_blank"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 12:42:18 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Timestamp-in-pre-execution-script-for-HTPP-monitors/m-p/118476#M370</guid>
      <dc:creator>HannahM</dc:creator>
      <dc:date>2020-11-03T12:42:18Z</dc:date>
    </item>
  </channel>
</rss>

