logo
down
shadow

Figure out the first Calendar Saturday based on the first day of the month


Figure out the first Calendar Saturday based on the first day of the month

By : edwing
Date : November 17 2020, 11:52 AM
Hope that helps Essentially what I'd like to be able to do is to find the first Saturday of the month based on the first day of the month. And I get conflicting information concerning this. , Try below function to return first saturday in month:
code :
Function GetFirstSatInMonth(ByVal initialDate As Date) As Date
Dim myDate As Date

myDate = DateSerial(Year(initialDate), Month(initialDate), 1)

Do While Weekday(myDate) <> vbSaturday
    myDate = DateAdd("d", 1, myDate)
Loop

GetFirstSatInMonth = myDate

End Function
Sub Test()

MsgBox (GetFirstSatInMonth(Date))

End Sub


Share : facebook icon twitter icon
Get saturday date value from a selected week using a month calendar

Get saturday date value from a selected week using a month calendar


By : Hence
Date : March 29 2020, 07:55 AM
I hope this helps . I am kinda stuck about this problem. How can I get the month calendar saturday values when i selected a specific date.
code :
// This function will return the next saturday for a datetime
DateTime NextSaturday(DateTime now)
{
   while (now.DayOfWeek != DayOfWeek.Saturday)
      now = now.AddDays(1);
   return now;
}
DateTime NextSaturday(DateTime now)
{
   do {
      now = now.AddDays(1);
   } while (now.DayOfWeek != DayOfWeek.Saturday)

   return now;
 }
DateTime Next(DateTime now, DayOfWeek nextDay)
{
   do {
      now = now.AddDays(1);
   } while (now.DayOfWeek != nextDay)

   return now;
 }
 namespace DateTime.Extensions
 {
   public static class DateTimeExtensions
   {
     public static DateTime Next(this DateTime now, DayOfWeek nextDay)
     {
        do {
          now = now.AddDays(1);
        } while (now.DayOfWeek != nextDay)

        return now;
      }
   }
 }
How to create a customized calendar to display just a particular Month on Button-click, with no Saturday and Sunday?

How to create a customized calendar to display just a particular Month on Button-click, with no Saturday and Sunday?


By : Vikul Singhal
Date : March 29 2020, 07:55 AM
This might help you I have a TextBox and a Button. When I enter the Month and Year (Example: April, 2013) in the TextBox, and click on the button, a customized calendar for that particular Month should be displayed.
code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

  protected void Button1_Click(object sender, EventArgs e)
  {
    string month = txtMonth.Text;// should be in the format of Jan, Feb, Mar, Apr, etc...
    int yearofMonth = Convert.ToInt32(txtYear.Text);
    DateTime dateTime = Convert.ToDateTime("01-" + month + "-" + yearofMonth);
    DataRow dr;
    DataTable dt = new DataTable();
    dt.Columns.Add("Monday");
    dt.Columns.Add("Tuesday");
    dt.Columns.Add("Wednesday");
    dt.Columns.Add("Thursday");
    dt.Columns.Add("Friday");
    dr = dt.NewRow();
    for (int i = 0; i < DateTime.DaysInMonth(dateTime.Year, dateTime.Month); i += 1)
    {
        txtMonth.Text = Convert.ToDateTime(dateTime.AddDays(0)).ToString("dddd");
        if (Convert.ToDateTime(dateTime.AddDays(i)).ToString("dddd") == "Monday")
        {
            dr["Monday"] = i + 1;
        }
        if (dateTime.AddDays(i).ToString("dddd") == "Tuesday")
        {
            dr["Tuesday"] = i + 1;
        }
        if (dateTime.AddDays(i).ToString("dddd") == "Wednesday")
        {
            dr["Wednesday"] = i + 1;

        }
        if (dateTime.AddDays(i).ToString("dddd") == "Thursday")
        {
            dr["Thursday"] = i + 1;
        }
        if (dateTime.AddDays(i).ToString("dddd") == "Friday")
        {
            dr["Friday"] = i + 1;
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            continue;
        }
        if (i == DateTime.DaysInMonth(dateTime.Year, dateTime.Month) - 1)
        {
            dt.Rows.Add(dr);
            dr = dt.NewRow();

        }

    }

    GridView1.DataSource = dt;
    GridView1.DataBind();

  }
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:TextBox ID="txtMonth" runat="server">Mon</asp:TextBox>
        <asp:TextBox ID="txtYear" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
        <br />
        <br />
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>

    </div>
    </form>
</body>
</html>
Get previous month's last day and if its not Saturday then get all the dates till saturday (incl Sat)

Get previous month's last day and if its not Saturday then get all the dates till saturday (incl Sat)


By : Axel JURAK
Date : March 29 2020, 07:55 AM
it fixes the issue Get last day of the previous month. If its not Saturday (of that week) then get all dates from the last day (whatever the dayofweek it is) till Saturday of that week (in yyyymmdd format)
code :
# Get the first day of this month at midnight, and step back a day to the last day of the previous month
${Date Stepper} = (Get-Date -Day 1 -Hour 0 -Minute 0 -Second 0 -Millisecond 0).AddDays(-1)

# Step forward, one day at a time, output the last day of the month until the following Saturday
$Counter = 1
Do
{

    ${Date Stepper} = ${Date Stepper}.AddDays(1)
    Set-Item -Path "Variable:Var$Counter" -Value ${Date Stepper}.ToString("yyyyMMdd")
    $Counter++

} While ([System.DayOfWeek]::Saturday -gt ${Date Stepper}.DayOfWeek)

# Test Outputs
Write-Host "Var1 = $Var1"
Write-Host "Var2 = $Var2"
Write-Host "Var3 = $Var3"
Write-Host "Var4 = $Var4"
Write-Host "Var5 = $Var5"
Write-Host "Var6 = $Var6"
Write-Host "Var7 = $Var7"
jQuery FullCalendar : Change the color of every saturday except last saturday in the month

jQuery FullCalendar : Change the color of every saturday except last saturday in the month


By : Amir
Date : March 29 2020, 07:55 AM
will help you viewDisplay: Option is not working on some older version So,try this if you have used old version of full calender try this
code :
viewRender: function(view) {
   $(".fc-sun, .fc-sat").addClass("non-working-day");
   $(".fc-sat:not(.fc-other-month)").last().removeClass("non-working-day");
},
.non-working-day{
    background-color: #FFe5e5 !important;
}
How do I efficiently setup a Linux crontab to run a script every Saturday of the month except the first Saturday

How do I efficiently setup a Linux crontab to run a script every Saturday of the month except the first Saturday


By : Balder Hagert
Date : March 29 2020, 07:55 AM
I wish this help you I want to run a script every Saturday except for the first Saturday of each month. (The script monitors a maintenance window, and the window is longer on the first Saturday of the month.) , Try this:
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org