title: How get azure storage table timestamp as string?
body: <p>I can get storage table rows using this PowerShell command:</p>
  
  <pre><code>$temp_table_name = "MY_TABLE_NAME"
  $saContext = (Get-AzureRmStorageAccount -ResourceGroupName $resourceGroup -Name $storageAccount).Context
  $temp_table = Get-AzureStorageTable -Name $temp_table_name -Context $saContext
  $result = Get-AzureStorageTableRowAll -table $temp_table
  </code></pre>
  
  <p>I have two Timestamp in my table, one is for azure table itself with name <code>Timestamp</code> and another one is for Metrics (stored automatically) with name <code>TIMESTAMP</code>. then the result of <code>$result[0]</code> is like bellow:</p>
  
  <pre><code>Average      : 3228132966.4
  Count        : 240
  CounterName  : \Memory\AvailableMemory
  DeploymentId : 2c90752b-100f-4640-a056-e2b894bf5bd5
  Host         : cpuusagetest
  Last         : 3230662656
  Maximum      : 3231711232
  Minimum      : 3225419776
  TIMESTAMP    : 10/16/2017 10:00:00 PM
  Total        : 774751911936
  PartitionKey : *************
  RowKey       : ***************__:005CMemory:005CAvailableMemory
  Etag         : W/"datetime'2017-10-16T23%3A00%3A05.5000867Z'"
  </code></pre>
  
  <p>I don't know why there is just <code>TIMESTAMP</code> and another one is <code>Etag</code>! in the result. anyway I can get Timestamp using this command:</p>
  
  <pre><code>$result[0].Timestamp
  </code></pre>
  
  <p>it will return always an string like <strong><code>10/16/2017 23:00:00</code></strong>, but in table's row it's stored something like <strong><code>2017-10-16T23:30:00.000</code></strong>. I need to get exactly the format that it's stored in the storage table.
  <br>
  I tried to change the format using a command like this:</p>
  
  <pre><code>[String]$result[0].Timestamp
  or
  $result[$j].Timestamp.toString("s")
  </code></pre>
  
  <p>but the result is same.
  <br>Please note When I am using <code>$result[$j].Timestamp.GetType().FullName</code> result is <code>System.DateTime</code>, then the <strong>type</strong> of Timestamp property in my table is <strong><code>DateTime</code></strong> and I can't (and don't want) to change it.
  <br>
  <a href="https://i.stack.imgur.com/wU4xt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wU4xt.jpg" alt="it&#39;s a screenshot of my Azure Storage Explorer that is showing that I have Minute &amp; Second &amp; milliseconds in my Timestamp"></a>
  Above is a screenshot of my Azure Storage Explorer that is showing that I have Minute &amp; Second &amp; milliseconds in my Timestamp
  <br><br>
  but when I am using this command:</p>
  
  <pre><code>$result[$j].Timestamp.toString("s")
  </code></pre>
  
  <p>result is without minuets and seconds...<br>
  I even test these commands too:</p>
  
  <pre><code>"{0:MM/dd/yyyy hh:mm:ss}" -f $result[$j].Timestamp
  </code></pre>
  
  <p>but the result is something like <code>10/16/2017 10:00:00</code>
  <br>
  Can you please guide me?</p>