Honeycomb Date range picker issues - reactjs

I was shown in date range picker past 60 from today date.when I try to select this month date its shows future month.
Example
When I select date range from sep 1 to sep 3 its shows Oct month but actually its not the it will shows only past date

Related

Getting Month Names From Current Month to April

How can I get The months names from Current month to April only using SQL
Ex:-if the current month is July then I want the month names from July to April.
Current month should be the running month.
Any function or something like that....(I need to get the data from Db for those months)
This should work:
WITH Dates AS
(
SELECT GETDATE() D
UNION ALL
SELECT DATEADD(MONTH,1,D) FROM Dates WHERE DATEPART(MONTH,D)!=4
)
SELECT DATENAME(MONTH,D) [Month Name] FROM Dates
Result
Month Name
------------------------------
September
October
November
December
January
February
March
April

SQL Server: Set Date Range to be Between --> 10 years ago from today's date and 10/11/2017

I want to select a date range based on my "DTIN" column. I want my date range to be between two date values.
I want my DTIN dates to be between 10 years ago from today's date and a pre-set date of October 11th 2017.
Below is the line of code I tried but SQL Server tells me the AND statement is off.
WHERE [DTIN] BETWEEN (DATEADD(Year, -10, GETDATE()) AND (CONVERT(datetime, '2017-10-11'))
I am aware that my 10 year's ago from today's date is also off in the code above.

Between clause in sql server

I am trying to find submitted data based on the start and end range entered.
Suppose i have submitted the data today, 30th june
When I give the range as start date, 1 june and end date, 30th june I dont get today's submitted data. When i give start date, 1 june and end date, 1st july I get today's submitted data. How to include start and end date too in the where clause?
AS
BEGIN
#Year navchar(200) = null
#Rtype navchar(200) = = null
SELECT *
FROM ProjectDetails
where SubmittedDate Between #Year and #Rtype
END
This is because you're misunderstanding how dates work. This is further evidenced by the fact that you're passing and using your dates as strings
First off, dates internally to sql server are expressed as numbers of days since a certain date (midnight on 1/1/1900)
This means a date of 2 jan 1900 is internally expressed by sqlserver as 1.0. A date of 1800 hours on 2 jan 1900 is expressed internally as 1.75 - because there have been 1.75 days since midnight on the first. 6pm is three quarters the way through a 24 hour day hence the .75 part in the internal representation
With me so far?
it is the decimal point part that is defeating your logic
Let's see an example
Lets say you want records between 1 jan 1900 and 10 jan 1900, so really, you want records that have a time anything up to 23:59:59 (and 999999... milliseconds) on 10 jan 1900
This means you want records that are between 0.0 and 9.999999999 days after midnight on 1 jan....
But when you're running your query, you're just asking for:
BETWEEN #1 jan 1900# and #10 jan 1900#
In SQL terms this is
BETWEEN 0.0 and 9.0
And not what you want:
BETWEEN 0.0 and 9.9999999999999999999999999....
Ultimately, midnight is the very first thing that happens on a day. You won't get any records for 6am on the 10th jan because that is WELL AFTER midnight, it is a decimal number like 9.25
I'm sure you can appreciate that 9.25 is NOT BETWEEN 0.0 and 9.0
You will however get records that occurred exactly bang on midnight on the 10th, because they would internally be represented as 9.0, and 9.0 is between 0.0 and 9.0
So you need to alter the way you are doing your query:
date >= startdate AND date < enddate_plus_one_day
i.e. in internal date representation tersm if you want yo get the dates that are 6am, i.e. the 9.25 days after 1 jan 1900, then you need to be querying date >= 0.0 and date < 10.0 - this will return the records all the way up to and including 23:59:59
I also complained at your querying style - youre passing dates as strings and hoping that sqlserver will figure you out. Don't do this. Be explicit:
SELECT *
FROM ProjectDetails
where SubmittedDate >= CONVERT(datetime, #Year, 112)--pass date as string in yyyymmdd
AND SubmittedDate < (CONVERT(datetime, #Rtype, 112)+1.0) --pass date as a string in yyyymmdd
- --Convert The Date And check The Result Output
DECLARE
#Year NVARCHAR(200) = null,
#Rtype NVARCHAR(200) = null
SELECT *
FROM ProjectDetails
WHERE CONVERT(NVARCHAR, SubmittedDate,111) >= CONVERT(NVARCHAR,#Year,111) AND CONVERT(NVARCHAR,
SubmittedDate,111)<= CONVERT(NVARCHAR,#Rtype,111)

Week end Date in netezza

I am looking for week start and end date in Netezza but my week starts from Mon and ends on Sun
Date Week Start Date Week End Date
11/30/2015 11/30/2015 Mon 12/06/2015 Sun
Day of Week functions begin on Sunday in Netezza
Template Patterns
Extract Function
You'll need to use modulo in order to deal with Sunday.
select
current_date
,current_date - mod(extract(dow from current_date) - 2),7) week_start
,week_start + 6 week_end

Date search range previous month to current month

I had a working SQL date search...
(DATEADD (dd,-30, getdate()) <= pymnt_pstd_dt)
it gives me data from the past 30 days, but what I actually need is a comparison of the previous month MTD with the current month MTD
I am currently struggling with a good way to write that for SQL
Any help would be appreciated.
Here are WHERE statements that will get month to date and previous month to date for your field, pymnt_pstd_dt:
WHERE pymnt_pstd_dt BETWEEN DATEADD(month,DATEDIFF(MONTH,0,GETDATE()),0) AND GETDATE() --Month to date
WHERE pymnt_pstd_dt BETWEEN DATEADD(month,DATEDIFF(MONTH,0,GETDATE())-1,0) AND DATEADD(MONTH,-1,GETDATE()) --Previous month to date

Resources