title: How to extract week day as a number from a Spark dataframe with the Scala API
body: <p>I have a date column which is string in dataframe in the 2017-01-01 12:15:43 timestamp format.</p>
  <p>Now I want to get weekday number(1 to 7) from that column using dataframe and not spark sql.</p>
  <p>Like below</p>
  <pre class="lang-scala prettyprint-override"><code>df.select(weekday(col(&quot;colname&quot;)))
  </code></pre>
  <p>I found one in python and sql but not in scala. can any body help me on this</p>
  <p>in sqlcontext</p>
  <pre class="lang-scala prettyprint-override"><code>sqlContext.sql(&quot;select date_format(to_date('2017-01-01'),'W') as week&quot;)
  </code></pre>