How do I get a Previous Month last day with Time of 11:59:59PM in SSRS - ssrs-2008

Here is what I have for the date Parameter.
=dateadd("m",0,dateserial(year(Today),month(Today),0))
I need to set the time to 11:59:59 PM

You could use a date representation of the first day of the current month and then simply subtract a day.
DateAdd(Day,-1,Date(Month(Today),1,Year(Today)))

Ok. I got it. Posting here for anyone that needs it:
=DateAdd("s",86399,dateadd("m",0,dateserial(year(Today),month(Today),0)))
This gives you the previous full month's last day, with the time set to 11:59:59 PM

Related

How to get the next Bi-weekly date based on a given start date and today's date in Google Sheets

I am trying to get bi-weekly dates based on a start date that would then provide the next upcoming date following the 14-day sequence from the start date, to get me the date that comes after today's date.
For example, if the start date is 6/15/2022, I would want the date every 14 days, and using today's date, I want to get the immediate next date that would still follow the 14-day sequence. Using today's date (6/30/2022), the next date I should get is 7/13/2022, which follows the 14-day sequence, since if you do MOD(DateDif(6/15/2022, 7/13/2022, "D"),14), you will get zero.
More Examples
Start Date: 6/15/2022
Today's Date: 6/30/2022
Next Needed Date: 7/13/2022
Today's Date: 7/14/2022
Next Needed Date: 7/27/2022
I only want to show the single next date, so I do not want to use sequence() or transpose() to fill up multiple rows/columns.
Any suggestions would be helpful, thank you.
try:
=B1+(14*ROUNDUP((TODAY()-B1)/14))

How to calculate the last week of every month?

I've been having a look around but I can't seem to find anything that answers this question. I want to calculate the date for the last week of every month. For example, the date for the last week of April 2021 is 26-04-2021. I want a date, not a week number.
I use Google Big Query, I do have a calendar table I could use to extract year and month.
Thanks,
Emily
Try date_trunc:
SELECT date_trunc(last_day(month1st, month), week(monday))
from unnest(GENERATE_DATE_ARRAY('2021-01-01', '2021-12-01', interval 1 month)) AS month1st;

Nifi - How to add or subtract months from date?

I want to get two fields: Begin date and End date of last month. For example, 14-04-2020 should give me the Begin date as 01-03-2020 and End_date as 31-03-2020. I have read the Nifi Expression language docs but all it can do with a date format is add or subtract in milliseconds. This is not helpful for my use case as the number of days in a month is not fixed and conversion to milliseconds won't help.
Is there a way to achieve my use case somehow using Nifi Expression language?
#AdarshKumar
NiFI Expression Language for this Use Case would be very clunky and unreliable for different timezones, months with <> 30 days, and leap years.
Please reference this post below which goes into detail for how to get "last month":
How to insert previous month of data into database Nifi?
In the Case of NiFi you kind of have to play with the dates to get the outcome
if you have the dates you easily convert a date and then just hard set a day to get the 1st day of the month with a hard coded day
${now():toNumber():format('yyyy-MM-01')}
to get the last day of the month you can either use the script or play with the calc using epoch time.
so to get the last day of the previous month you can just use the date and convert the day into epoch time and subtract it from the epoch date to get last day of previous month
example
${now():toNumber():format('yyyy-MM-dd'):toDate('yyyy-MM-dd', 'GMT'):toNumber():minus(${now():toNumber():format('dd'):toNumber():multiply(86400):multiply(1000)}):format('yyyy-MM-dd')}
in this example above we convert the date to epoch format it to convert again, conversion happens to remove default timestamp and then we use the same formula to get just the day as a number to multiply it with 86400 seconds in a day and multiply that by 1000 for the epoch number to subtract from the date which is then formatted back into a date.
Raw Date: Thursday, August 26, 2021 11:20:31 AM
formatted: Thursday, August 26, 2021 12:00:00 AM
epoch of formatted date: 1629936000000
Subtract Epoch: 2246400000 (86400 seconds * 26 days * 1000)
result: 2021-07-31
alteratively you could first add a month and the work back to get the current day of the given month
this example is just to give you an idea of ways you can use built in date functions with epoch time to calculate the correct date, removing the issues with months that end on specific numbers.
I try UpdateAttribute to minus month
test${now():toNumber():format('yyyyMM'):minus(1)}01

Creating Dynamic Date Column Headings in Cross Tab for Business Objects

BO Version: 12.1.0 on Infoview,
O/S: W7
I am creating a report in infoview, which is a cross-tab. I have departments on the row side and for the column I want to have all Saturday dates dynamically displayed, and this is dependent on the date prompt values I put in to the report when I run it.
So if I put in for the prompts Dec the 08th 2013 to Jan the 04th 2014 I should see 4 Saturday dates (14th/21st/28th/04th) along the column headers.
I started off using a variable and using the function relativedate, which gave me all the dates I wanted:
=RelativeDate(LastDayOfWeek([Query 1].[Episode End Date]);-1)
but because I used -1 to get the Saturday date it was giving me the Saturday before the earliest prompt date, so I was getting these dates instead:
(07th/14th/21st/28th/04th)
Is there a way I can get these dates but ignore the previous day (the 7th) before the start prompt date?
I want to have this dynamic so that if I put a date range in it shows me all the saturday dates within that range along the top of the report regardless of the date range period.
Andrew
The reason you're having trouble is that WebI (being ISO compliant) considers a week to run from Monday to Sunday, but your reporting week ends on Saturday.
So, I would approach it this way:
=RelativeDate(
LastDayOfWeek(
RelativeDate([Query 1].[Episode End Date];1)
)
;-1)
If we evaluate some dates with this logic, we'll see the desired result:
Testing 12/8 (Sunday):
Add one day = 12/9
Get Last Day Of Week = 12/15
Subtract one day = 12/14
Testing 12/12 (Thursday)
Add one day = 12/13
Get Last Day Of Week = 12/15
Subtract one day = 12/14
Testing 12/14 (Saturday)
Add one day = 12/15
Get Last Day Of Week = 12/15
Subtract one day = 12/14
I'm at home and don't have access to WebI right now, so I can't test this myself, but the logic should be sound.

How to get last year's date in Unix Bourne Shell?

I know of methods to get the date from yesterday, 1 month ago, etc.
How do you get the date from 1 year ago?
For example:
Current date 20120802 and last year's date 20110802.
Of course I could change the 2012 to 2011, but is there a way that does not require manual intervention?
You may use:
date --date="1 year ago"
for more..
You can see here..
http://www.cyberciti.biz/tips/linux-unix-get-yesterdays-tomorrows-date.html