[Solved] Get days of a week, by a day of the month

private DateTime[] weekByDay(DateTime date) { DateTime[] week = new DateTime[5]; while (date.DayOfWeek != DayOfWeek.Monday) //while day is not monday { date = date.AddDays(-1); //substract 1 day to date } week[0] = date; //add the current day (monday), to the array for (int i = 1; i < 5; i++) //add the next day till Friday … Read more

[Solved] Data Structure for keeping time and day of the week PHP

Untested and probably not the best way class TimeWeekday { private $hour; private $minute; private $day; private $days = array(‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’, ‘Sunday’); public function __construct($hour, $minute, $day) { $this->hour = $hour; $this->minute = $minute; $this->day = $day; } public function add($hours, $minutes, $days = 0) { $newMinutes = $this->minute + $minutes; … Read more

[Solved] Giving wrong day of week in PHP

You need to use date format “Y-m-d” to get the result you want. $date=”2017/06/07″ means June 07, 2017. If you want to get the day of July 06, 2017 then change $date=”2017/06/07″; To $date=”2017/07/06″; 0 solved Giving wrong day of week in PHP

[Solved] How to get day of week name from selected date month and year in Android?

First convert your Date in to specific Date format using SimpleDateFormat Use SimpleDateFormat simpleDateFormat = new SimpleDateFormat(“EEEE”); to get Day name in week WHERE EEEE -> Day name in week SAMPLE CODE SimpleDateFormat inFormat = new SimpleDateFormat(“dd-MM-yyyy”); try { Date myDate = inFormat.parse(date+”-“+month+”-“+year); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(“EEEE”); String dayName=simpleDateFormat.format(myDate); } catch (ParseException e) { … Read more