As in this excel,
I want calculate dates in each month. To get this data, I can calculate with my brain but not KNIME…
I need help here.
Then because I have units in each month
and I know the full dates of the month
I can get
FinalValues will be Dates divide FullDates x Units.
datecal.pptx (34.1 KB)
The date does not contradict (in/exclusive) because I want to have the duration.
so the start should come from end of month minus the start date and end should come from the beginning of the month minus the end date and add minus again.
Is there any simple way to solve this?
in VBA it should be
dateW = DateSerial(lngTounen, lngMcnt, 1)
If Year(dateW) = Year(dateS) And month(dateW) = month(dateS) And _
Year(dateW) = Year(dateE) And month(dateW) = month(dateE) Then
dateMS = dateS
dateME = dateE
flgMatch = True
ElseIf Year(dateW) = Year(dateS) And month(dateW) = month(dateS) Then
dateMS = dateS
dateME = DateSerial(Year(dateS), month(dateS), Day(DateSerial(Year(dateS), month(dateS) + 1, 0)))
flgMatch = True
ElseIf Year(dateW) = Year(dateE) And month(dateW) = month(dateE) Then
dateMS = DateSerial(Year(dateE), month(dateE), 1)
dateME = dateE
flgMatch = True
Else
Dim dateSfirst As Date
Dim dateElast As Date
dateSfirst = DateSerial(Year(dateS), month(dateS), 1)
dateElast = DateSerial(Year(dateE), month(dateE), Day(DateSerial(Year(dateE), month(dateE) + 1, 0)))
If dateSfirst < dateW And dateW < dateElast Then
dateMS = DateSerial(Year(dateW), month(dateW), 1)
dateME = DateSerial(Year(dateW), month(dateW), Day(DateSerial(Year(dateW), month(dateW) + 1, 0)))
flgMatch = True
End If
End If