title: Convert Milliseconds to SQL datetime
body: <p>How can I convert milliseconds into SQL datetime ?</p>
  
  <p>I transfer the variable start &amp; end like this:</p>
  
  <pre><code> var interval = scheduler.GetSelectedInterval();
   var resourceId = scheduler.GetSelectedResource();
   var start = _aspxDateTimeToMilliseconds(interval.start);
   var end = _aspxDateTimeToMilliseconds(interval.end);
   window.location.href = 
      "FicheAgenda.aspx?Page=ACTION&amp;Mode=Creation&amp;start=" + 
           start + "&amp;end=" + end +"&amp;resourceId=" + resourceId;
  </code></pre>
  
  <p>the output:</p>
  
  <pre><code>FicheAgenda.aspx?Page=ACTION&amp;Mode=Creation&amp;start=1334579400000&amp;end=1334584800000&amp;resourceId=24
  </code></pre>
  
  <p>and on FicheAgenda.aspx I want to convert this start &amp; end value into a datetime</p>
  
  <pre><code>     &lt;asp:SqlDataSource ID="SqlDataSource_Activity" runat="server" 
          ConnectionString="&lt;%$ ConnectionStrings:OnyxConnectionString %&gt;" 
          SelectCommand="SELECT DISTINCT [ID_ACTIVITE], [LIBELLE_ACTIVITE]
                         FROM [ESPTEMPS_ACTIVITE]
                         LEFT JOIN ESPTEMPS_PROGRAMMATION
                  ON ESPTEMPS_ACTIVITE.ID_ACTIVITE = ESPTEMPS_PROGRAMMATION.ID_ACTIVITY
                          WHERE DATEADD(MINUTE, 
                                  CONVERT(int, SUBSTRING(HEURE_DEBUT, 3, 2)), 
                                  DATEADD(HOUR, 
                                    CONVERT(int, SUBSTRING(HEURE_DEBUT, 1, 2)), 
                                     DATE_DEBUT))
                                 &lt; convert(datetime,@StartDate)
                          AND
                                DATEADD(MINUTE, 
                                  CONVERT(int, SUBSTRING(HEURE_FIN, 3, 2)), 
                                  DATEADD(HOUR, 
                                    CONVERT(int, SUBSTRING(HEURE_FIN, 1, 2)), DATE_FIN))
                                &gt; convert(datetime,@EndDate) "&gt;
   &lt;SelectParameters&gt;
      &lt;asp:QueryStringParameter Name="StartDate" QueryStringField="start" /&gt;
       &lt;asp:QueryStringParameter Name="EndDate" QueryStringField="end" /&gt;
   &lt;/SelectParameters&gt;             
   &lt;/asp:SqlDataSource&gt;
  </code></pre>