How can I set the first day of the week to monday in dojox.calendar (columnview) - date

How can I set the first day of the week to monday in dojox.calendar (columnview)?
http://dojotoolkit.org/reference-guide/1.9/dojox/calendar.html
In the documentation it says there is a startDate property in the columnView,
but you have to set a date. How can I set the startDate on Monday?
If I set a startDate, nothing changes.

startDate * - The date of the first column,
Properties with an (*) are computed by the calendar widget.
The calendar renders the startdate from the locale of the browser.

Related

Calculate next pay day in Swift

I am trying to do some math calculations in Swift and getting a bit stuck.
Essentially we get paid every 4th Friday, and I want to do a calculation that based on today's date, works out how many days until our next Pay Day.
I've got a reference day of "28/03/2008",
In order to calculate the next 4th Friday of the month, you need a combination of the right DateComponents and Calendar.
// The 4th Friday at noon
let payDayComps = DateComponents(hour: 12, weekday: 6, weekdayOrdinal: 4)
// Given the current date, calculate the next 4th Friday at noon
let nextPayDay = Calendar.current.nextDate(after: Date(), matching: payDayComps, matchingPolicy: .nextTime)
You don't need a past reference date for this if your goal is to get the next 4th Friday based on today's date. Change the value of the after parameter if you need to calculate the 4th Friday based on some other specific date.
If this is run on the 4th Friday of a month then it will return today's date if run before noon and it will return the 4th Friday of the next month if run after noon. Change the hour value in payDayComps if you want different results (such as 0 for midnight).
To calculate the number of days until that next pay day you can do:
let daysToPayDay = Calendar.current.dateComponents([.day], from: Date(), to: nextPayDay).day!

SSRS: Default Values for StartDate Parameter Based on EndDate Parameter

I'm working with SSRS and using Visual Studio 2012.
I have two parameters StartDate and EndDate and I configured default values for each.
The default values currently for both are the following:
StartDate: =DateAdd("d",-(Day(today)-1), Today)
EndDate: =Today() - 1
I want the values to bring in:
StartDate: 1/1/2017
EndDate: 1/31/2017
Basically, I want EndDate to be the previous day (e.g. EndDate for today would be 1/31/2017 since today is 2/1/2017.)
And then for StartDate, I want that to be the first day of the month that EndDate pulls in (e.g. since EndDate pulled in 1/31/2017, the StartDate should pull in 1/1/2017.)
However, with the current parameters in place, StartDate pulls in 2/1/2017 and EndDate pulls in 1/31/2017.
How do I get StartDate to pull in the 1st day of the month based on the value of EndDate?
For StartDate you can use:
=DateSerial(Today.AddDays(-1).Year,
Today.AddDays(-1).Month,
1)
Let me know if this helps.

How to create a specific date in Google Script

I have a spreadsheet that asks people to enter in a day of the month when we need to send out a bill. What I want to do is create a calendar event based on that. So, essentially what I need is an event that starts at the current month, day from the spreadsheet, and continues to a specified point in time.
var monthlyDate = row[6]; // Seventh column, monthly date of payment
var curDate = new Date();
var curMonth = curDate.getMonth();
var curYear = curDate.getYear();
curDate.setDate(curMonth, monthlyDate, curYear);
Logger.log("Day of month: %s", monthlyDate);
Logger.log("Current Date: %s", curDate);
Logger.log("Current Date: %s", Date());
What I'm seeing is that the monthly date is coming in as a float "6.0" for example, and no matter what I enter in for monthlyDate in the setDate line, it keeps setting the date to 10/9/15 (Today is 10/15/15). I've hard-coded that value to many different numbers, but for some reason it's just not working.
How can I create a date (in any format) that follows the scheme "Current Month / Day from Speadsheet / Current Year" ?
The getMonth() method returns a "zero-indexed" number. So, it returns the number 9 for the 10th month. setDate() doesn't set the date, it sets the "Day of the Month". The name of that method is misleading.
Documentation - setDate()
So, the last two parameters that you are using in setDate() are doing nothing. You are setting the day of the month to 9.
If you want to set multiple date parameters at the same time, you need to use the new Date() method:
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);
The month parameter accept values from 0 to 11, 0 is Jan and 11 is Dec
Date Reference

MS Access 2010 (Design View): return Monday of the current week with Monday as 1st day of the week

I need to make my Access query always return the Monday of the current week. I have seen a few solutions on Google/StackOverflow but they are written in SQL and I am a beginner in creating Access queries (I am using the Design view to make them).
Goal: The week should be considered as M T W T F S S. Then, the query should always return the Monday of the current week. Therefore, if it is Sunday, it should still return the Monday before, NOT the next week's Monday. Can anyone explain how to do this using the Design View in Access 2010?
Keep in mind that in this context we are working with dates, so if we do Date() - 1, we will get 1 day prior to today.
Date() ~ Today's date
DatePart(
"w" - Weekday
Date() - Today's date
2 - vBMonday (Access assumes Sunday is the first day of the week, which is why this is necessary.)
1 - vbFirstJan1 - This gets into using the first week of the year. We could have omitted this, as 1 is the default.
)
-1 - Subtract 1 from the DatePart value.
Values
Date() = 4/27/2015 (at time of this writing)
DatePart("w",Date(),2,1) = 1
DatePart("w",Date(),2,1)-1 = 0
So we have Date()-0... Okay, what's so great about that? Well, let's look at a more useful scenario where today's date is a day other than Monday.
Let's act like today is 4/28/2015 (Tuesday)
Date() = 4/28/2015
DatePart("w",Date(),2,1) = 2
DatePart("w",Date(),2,1)-1 = 1
So, from the outside, in; give me the current weekday value. (1 = Monday, 2 = Tuesday, etc.), and subtract 1 from that -> that's how many days we need to subtract from the current date to get back to the weekday value of 1 (Monday).
Here's a function that will do this:
Public Function DatePrevWeekday( _
ByVal datDate As Date, _
Optional ByVal bytWeekday As VbDayOfWeek = vbMonday) _
As Date
' Returns the date of the previous weekday, as spelled in vbXxxxday, prior to datDate.
' 2000-09-06. Cactus Data ApS.
' No special error handling.
On Error Resume Next
DatePrevWeekday = DateAdd("d", 1 - Weekday(datDate, bytWeekday), datDate)
End Function
As vbMonday is 2 and your date is today, you can use the core expression in a query:
PreviousMonday: DateAdd("d",1-Weekday(Date(),2),Date())

display a date from the other calendar as selected

I have two calendar, when I select fist calendar value then my second calendar will shows previous calendar value +2 as selected ( i.e. when I select 2/07/2012 from first calendar then my second calendar will shows 4/07/2012 )
Is it possible?
Simply create a new date by adding the appropriate amount of seconds:
NSDate *newDate = [selectedDate dateByAddingTimeInterval:60*60*24*2];
and use that date as the basis for your new calendar.