title: How can I retrieve the seconds part of TIME in cmd?
body: <p>I'm trying to write a cmd script that gets the current date and time and formats it into a way that sqlserver can input it as a <code>datetime</code>.</p>
  
  <p>So far, I have:</p>
  
  <pre><code>@echo off
  for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
  set dow=%%i
  set mon=%%j
  set day=%%k
  set yr=%%l
  set mydate=%%j/%%k/%%l
  )
  </code></pre>
  
  <p>This prints out 10/22/2010</p>
  
  <p>I have not been able to figure out how to get the time into a usable format. I tried working with <code>time /t</code>, but it only gives the hours and minutes, and I need the seconds also.</p>