How to implement datetime data in Neo4J - neo4j

I want to implement Dynamic timeline tree in Neo4j.
I have Accounts with transactions. Sample Data below
AC#
Year
Month
Day
Debit
Credit
123456
2019
Mar
01-03-2019
1000
1000
123456
2020
Apr
01-04-2020
2000
2000
123456
2020
May
01-05-2020
2000
2000
123457
2018
Jan
01-01-2018
2000
2000
123457
2021
Mar
01-03-2021
1000
1000
123458
2017
Jan
01-01-2017
2000
2000
123458
2021
Mar
01-03-2021
1000
1000
If the users clicks on any account number, Year node should open and on clicking Year node, Month nodes should open and so on.
Year and Month nodes should be dynamic. This means if some year is not available for an account number it should not be displayed.
Please help

Related

google sheets query filter by datediff is this possible?

So i use the following formula:
query(OVERVIEW!$B$11:$W;"Select B,C,D,I,G,H,K where month(C)="&0+$D$11&"and W matches '"&IF($B$10=TRUE;"CREATE PO";"")&"' Order by "&$B$3&"")
and what it does it checks in which month you are looking and based on the forecast it will check a couple of months and return the result in the table.
So for this example, lets say I have 12 monthly tables
Jan Feb Mar Apr Mei Jun Jul Aug Sep Okt Nov Dec
I want data to be filled under each table + forecast of 3 months
So in Jan, I get Mar orders for example. this works as it is now but if go to let's say
Okt it should give me 3 months later data so in Jan next year only the formula I have does it for this year only and if I remove the year part I get both years Jan and that is not what I want. it should count furter so Dec 2021 + 3 months will be Marth 2022.
Any pointers?
I was thinking something with Datediff en EOMONTH() functions??
Example what needs to be
UPDATE: Link to file:https://docs.google.com/spreadsheets/d/1ti7TdF2mWEGxA1E4FIeNJ7sEEtYTgu4UQtMxYqS7ets/edit?usp=sharing
Update I have created a working example in the second tab with the
following formula:
=IFERROR(QUERY(C4:C22,"select * where C >= date '"&TEXT(DATEVALUE(EOMONTH("01-01-"&E1,D1-1)+1),"yyyy-mm-dd")&"'and C <= date '"&TEXT(DATEVALUE(EOMONTH("01-01-"&E1,D1)),"yyyy-mm-dd")&"'"))
i do not know if this is the best solution but it works XD
=IFERROR(QUERY(C4:C22,"select * where C >= date '"&TEXT(DATEVALUE(EOMONTH("01-01-"&E1,D1-1)+1),"yyyy-mm-dd")&"'and C <= date '"&TEXT(DATEVALUE(EOMONTH("01-01-"&E1,D1)),"yyyy-mm-dd")&"'"))
pasting the above code in each colum and change the month to the same month you need for example Feb is "01-02"

How to get days between two dates in google sheet

I have been trying to get the number of days between two dates in google-sheet but sometimes it gives an integer and sometimes it gives another date. How to get only the integer?
Shared public sheet (sheet name DS):
https://docs.google.com/spreadsheets/d/10NzbtJhQj4hQBnZXcmwise3bLBIAWrE0qwSus_bz7a0/edit#gid=517697699
Example
SN COMPANY AppliedDate DaysSince Today
-----------------------------------------------------------
2 McDonald Feb 17, 2021 54 1
3 Nielson Feb 17, 2021 Apr 20, 1900 2 **This should be number NOT date
4 Edelman Feb 17, 2021 111 3
5 Upstart Feb 19, 2021 Apr 18, 1900 1
6 Root Inc. Feb 19, 2021 Apr 18, 1900 2
Required
For the column DaysSince I would like to have only number. I want number between two dates but sometimes the same formula works sometimes does not work.
Is there any other methods to get number of days between two dates?
Go Format > Number > Number to format you entire column. Your problem is that your format is set as Automatic.

Is there any function in GSheet to calculate total time spent for current date with two different unit of time in single column?

I have a GSheet looks like as follows -
TimeSpent
Date.
15 Minute
26 May 2021
20 Minute
26 May 2021
05 Hours
26 May 2021
40 Minute
25 May 2021
20 Minute
24 May 2021
03 Hours
23 May 2021
02 Hours
20 May 2021
Queries -
(1) Wanted to calculate total time spent for today's date(Current date)
(2) There are two different units of time - Minutes and Hours.
try:
=TEXT(SUM(FILTER(IF(REGEXMATCH(A:A, "Hours"),
REGEXEXTRACT(A:A, "\d+")*60,
REGEXEXTRACT(A:A, "\d+")*1), B:B=TODAY()))/1440, "[hh] \Hour\s mm \Minut\e\s")

Why does adding and subtracting 2 months to a date not give back the same date?

I'm a bit confused about this outcome, taking today's date minus 2 months, and then taking that date again and adding two months, does not give me today's date when assign the dates to a variable.
Time.zone
"Eastern Time (US & Canada)"
> today = Date.today.in_time_zone
=> Thu, 31 Aug 2017 00:00:00 EDT -04:00
> a = today - 2.months # This is persisted to the db
=> Fri, 30 Jun 2017 00:00:00 EDT -04:00
> b = a + 2.months
=> Wed, 30 Aug 2017 00:00:00 EDT -04:00
If I however, just use the same object, it moves back and forth properly:
> today = Date.today.in_time_zone
=> Thu, 31 Aug 2017 00:00:00 EDT -04:00
> today - 2.months
=> Fri, 30 Jun 2017 00:00:00 EDT -04:00
> today + 2.months
=> Tue, 31 Oct 2017 00:00:00 EDT -04:00
The problem is obviously when "a" gets saved to a database, and then retrieved later on, and calculated plus 2 months..., it should match today's date.
TL;DR
A month is not a fixed duration. Adding or taking a month does not give the same "time shift" depending on which day you are.
The usual algorithm
to add or take months is the following :
try to land on the same day number (4th, 30th, 31st) as you started, just by changing the month
if you would land on an impossible date (like 31th September, 30th February, 29th February for some years) then just go the maximum allowed day number of this month
This implies that adding some months then taking out the same number of months will not necessarily give you back the same date.
Examples :
31st of some month + 1 month --> One would want to get to the 31th of next month
But if there is no 31st of next month (like for 31th of August, no 31st of September), then what to do ?
Usual interpretation would say that you want to go to the end of the month, this is 30th September (for rent or other monthly subscription, for instance)
But usually, 30th of some month - 1 month --> One would want to get to the 30th of the previous month.
That would lead to .... 30th of August. Not 31th of August.
Hence: some date + 1 month - 1 month does not necessarily give the original date !
Another example :
Start at the 30th of August.
Take a month -> 30th of July
Add a month -> You want to get to 30th of August (same number, next month) or to the end of August ?
The default algorithm will try to give the same day number -> 30th of August (which is more logical now)
Also with days...
Note that the same problem happens with days,but much less often ! When some days don't have the same number of hours, for daylight saving days, when adding and taking same number of days you might not get back to the original date and time as you started from.

Get list of weeks that start on a Friday

I want to count the number of the weeks, starting from Friday.
For more explanation: usually the counting starts on Sunday or Monday, but in this case, I want to make it start on Friday.
Some examples:
2nd Jan 2015 (Fri) ~ 8th Jan 2015 (Thu) : 1st week of 2015
...
25th Dec 2015 (Fri) ~ 31st Dec 2015 (Thu) : 52nd week of 2015
1st Jan 2016 (Fri) ~ 7th Jan 2016 (Thu) : 1st week of 2016
...
30th Dec 2016 (Fri) ~ 5th Jan 2017 (Thu) : 53rd week of 2016
6th Jan 2017 (Fri) ~ 12th Jan 2017 (Thu) : 1st week of 2017
What I need to do is
1) to get the week number from the date
ex.
input: Fri, 02 Jan 2015
output: 1
input: Sun, 27 Dec 2015
output: 52
2) to get the date range for the given week number.
I found that .strftime("%V") does almost this, but it counts weeks by every Monday.
Does anyone know nice solution to this?
Here you go:
my_array = Array.new
(Date.today..Date.today.next_year).each do |date|
if date.wday == 5
end_week = date + 6.days
my_array << "#{date.day.ordinalize} #{date.strftime('%b')} #{date.strftime('%Y')} (#{date.strftime('%a')}) ~ #{end_week.day.ordinalize} #{end_week.strftime('%b')} #{end_week.strftime('%Y')} (#{end_week.strftime('%a')}) : #{date.strftime('%U')} week of #{date.strftime('%Y')}"
end
end
# sample output of first element of array
# 30th Oct 2015 (Fri) ~ 5th Nov 2015 (Thu) : 43 week of 2015
Note: You can set any range. here I have set from Today to next year
%U - Week number of the current year, starting with the first Sunday
as the first day of the first week (00..53)
%W - Week number of the current year, starting with the first Monday
as the firstday of the first week (00..53)
for more info: http://apidock.com/rails/ActiveSupport/TimeWithZone/strftime
You can do the variety of operation on the dates here...
DateAndTime
In your case, the below will work for you.
all_week(start_day = Date.beginning_of_week)

Resources