In my current project i need to show most three months events details from the given response (eventTimestamp) array.
this is response:
[
{
"patientEventsId": 11,
"userId": 72,
"patientId": "CDMRI-U-2017030341",
"doctorId": "CDMRIDR2017030012",
"doctorEventsId": 18,
"doctorEventName": "Hypoglycemia",
"eventTimestamp": "2017-03-31 11:54:15",
"recordTimestamp": "2017-03-31 11:54:30",
"reviewed": false
}
]
I need to calculate:
most recent three months names
get dates of that particular month which are in response
List no of events on that particular date (count) in
that particular month
Find difference between two NSDates timeStamp using Swift to check the following Links,
Link-1
Link-2
Link-3
Link-4
Link-5
Link-6
Related
I would like to express the following expression in Google Sheets:
IF today's date is less than or equal to the last day of the current month (in this case October 2021), THEN output today's date, OTHERWISE output the last day of the month (i.e. October 31, 2021)
I've tried a few different ways but nothing seems to work. Below is my latest attempt, but I get an #ERROR.
=IF(TODAY(<=2021,10,31),TODAY(),DATE(2021,10,31))
Thank you in advance for your help.
You need EOMONTH() function. Try below formula-
=IF(TODAY()<=EOMONTH(TODAY(),0),TODAY(),EOMONTH(TODAY(),0))
Just use =TODAY(). if you are interested in current month.
If you need today's date, but not further then the last day of October, use:
=MIN(TODAY(), DATE(2021, 10, 31))
I want to create a calendar like in the second image. But I can not figure out how to start the first column is a monday. So I fill it by 'hand' like in the first image.
I tried to create it automatic. Starting with the first day of the month and add one day the next columns like in the second picture:
How I want it to look like:
How it is currently looking:
Google sheets example
I was solving the same problem for my bussiness, and I think I got the answer.
Your first task is to determine the first "calendar monday" of the month.
First, build the first day of the corresponding month:
[B2] =DATE(YEAR(A1); MONTH(A1); 1)
Then, get the WEEKDAY of the corresponding first day. The second argument represents what day your week starts with:
If type is 1, days are counted from Sunday and the value of Sunday is 1, therefore the value of Saturday is 7.
If type is 2, days are counted from Monday and the value of Monday is 1, therefore the value of Sunday is 7.
If type is 3, days are counted from Monday and the value of Monday is 0, therefore the value of Sunday is 6.
In my case, we count the week starting from Monday. This means when the first day of the month lands on Monday, the return value will be 0.
[C2] =WEEKDAY(B2; 3)
The number you get represents how many days you need to substract from the initial date to get the first "calendar monday" of the month:
[D2] =B2 - C2
This date is what you are looking for. The final formula:
[A3] =DATE(YEAR(A1); MONTH(A1); 1) - WEEKDAY(DATE(YEAR(A1); MONTH(A1); 1); 3)
The rest of the days, simply add 1 to each preceding date.
[A4] =A3 + 1
[A5] =A4 + 1
And so on.
Secondly, set the Number Format on the calendar cells to just show the day.
Format -> Number -> More Formats -> More Date and Time Formats.
Select just the day from the drop down.
Finally, use conditional formatting to "hide" the values that don't match the initial date
Use a custom formula for the formatting, as follows:
=MONTH(A3) <> MONTH(A1)
Apply to the calendar range. This will format dates that don't belong to the current date, so make sure to paint that white.
And that's about it. Good luck!
I am retrieving booking records from a mongo database but want to organise the collection of records returned so that the embedded structure is like so:
2018
{
january
{
{booking_id: 1, date: 2018-01-01T20:00:00Z}
{booking_id: 2, date: 2018-01-02T20:00:00Z}
}
february
{
{booking_id: 3, date: 2018-02-01T20:00:00Z}
{booking_id: 4, date: 2018-02-02T20:00:00Z}
}
..
}
2017
..
I am able to group them by date like so:
#bookingsdaily = #bookings.all.group_by(&:date)
but am unsure how I could do this and create additional layers. I was thinking I should possibly group by year first and then with each year collection sort by month then day but not sure how exactly I would achieve this. Any pointers or suggestions are appreciated.
I have a few years of sample data that I'd like to break at year end (12/31) of every year. Trying to implement this code from example from API
breaks: [{ // break on last day of year
from: Date.UTC(2008, 12, 31, 58),
to: Date.UTC(2008, 12, 31, 59),
repeat: 24 * 36e5 // not sure how to use this
}],
is there a way to ignore the year in Date.UTC()? Also I'd like to repeat this every year. Tied numerous combos to no avail. Heres my jsfiddle
Adding null value point will create a gap in a series plot if connectNulls is set to false (by default it is false).
Example: http://jsfiddle.net/c9e9ao2L/1/
I want to add 1 month to date, but it is adding only 4 weeks.
I tried like this,
2012-05-04 + DateTimeUtilities.ONEMONTH = 2012-05-31
The result i am getting is 2012-05-31
I want to add a full month (30 days or 31, or when month is a leapyear 29 or 28).
Try converting your time to a Calendar object then increment the month field:
Calendar cal = Calendar.getInstance();
cal.setTime(new Date(timeInMillis));
cal.set(Calendar.MONTH, cal.get(Calendar.MONTH)+1);
long newTimeInMillis = cal.getTime().getTime();
You may want to check for overflow from December to January and increment the year.
The API documentation confirms that DateTimeUtilities.ONEMONTH is four weeks, so what you got is what you should expect.