10 months ago

Get day of week

Simply get day of week.

­čĺ╗JavaScript Snippets

  var d = new Date("2012-09-10");
  var n = d.getDay();

It will show 1

­čĺ╗PHP Snippet <?php $date = "2012-09-10"; $dayofweek = date('w', strtotime($date)); print_r($dayofweek); ?>

It will show 1

­čĺ╗Python Snippet import datetime print(datetime.datetime.strptime('10 09 2012', '%m %d %Y').weekday())

It will show 1

Do you have any comment on this tricks? then let the author know about that. comment here