DateTime picker with vue-ctk-date-time-picker - vue.js

I have been trying t figure this out for the pas 6 hours. Can someone please help me.
I used this DateTime picker vue-ctk-date-time-picker
Link to gitRepo https://github.com/chronotruck/vue-ctk-date-time-picker
My startdate looks like this in my vue data start: moment().format("YYYY-MM-DD HH:mm")
example: 2020-06-28 19:30
Now the date picker works fine and starts at that date and time. Perfect!
I want to add a maxDate to the dateTimePicker so people cant select a date and time higher than the current date. So i made another property in data like this
maxDate: moment().format("YYYY-MM-DD HH:mm")
Which is again just the datetime now.
As soon as i add the prop :maxDate='maxdate' on the date picker it keeps the date but the time goes to 00:00
Does not matter what format i make it and also does not matter if i use moment or not. maxDate prop changes my start date time to 00:00 and maxdate to 00:00.
If i do minDate with the exact same props and data then minDate work as expected. Time is correct date is correct.
Switch it back to maxDate and BOOOM! freakin 00:00 again
What am i doing wrong?

So figured it out. Max date should just be the date in date format without time.
maxDate = moment().format("YYYY-MM-DD")
and not
maxDate = moment().format("YYYY-MM-DD HH:mm")

Related

SQL query for updating the date automatically

I am working on creating a dashboard on Tableau. To get the best result, I am writing a code on SQL first. But, my requirement is to update the date between specific dates. For example, in SQL, I want to filter the date range and it will update automatically for tomorrow. Below is my filter code.
WHERE date BETWEEN '2020-02-02 00:00:00' and '2021-02-03 00:00:00'
------------------------------------Expectation-------------------------------------------------------
Tomorrow date range: 2020-02-03 00:00:00 and 2021-02-04 00:00:00
after a month date range : 2020-03-03 00:00:00: and 2021-03-04 00:00:00
In short, I won't need to re-range the date filter manually and date would be update automatically on Tableau as well.
Could anyone help me with this issue ?
In SQL just use the now() function - to which you can add/subtract days as necessary
In Tableau use Relative Date Filters
For doing this on Tableau, simply add the `[date] field on filters card, click relative dates and use the following options..
A screenshot for simplest of data
I would recommend:
WHERE date >= CURRENT_DATE AND
date < DATE_ADD(CURRENT_DATE, INTERVAL 1 DAY)
Note that this code does not use BETWEEN. I see no reason to double count midnight on different dates. This captures only the times that are with in the day, from midnight to just before midnight when the next day begins.

How to default the date time other than today in SSRS

I have a parameter #enddate to get the date value. Currently we have default value as Now().
It works fine with a today date and current time.
When I pick another day for this enddate, it shows as the d but the time never changes.
Can I default the time as 11:59:59pm when select days other than today but still get the current time when select today?
Thank you
You can make some changes to your query and parameter set up and you will be able to accomplish what you asked, "default the time as 11:59:59pm when select days other than today but still get the current time when select today".
Add another parameter after your #enddate and I will call it #enddate2. Set #enddate2 to be a datetime field, set it to hidden, and replace all existing #enddate in your queries with #enddate2.
Use the below code for your #enddate2 default value. The code basically says if your #enddate is the current day, then it will display same value as what you had (today with current time). Otherwise, it will use the date from #enddate and add 11:59:59pm to the time.
=IIF(
Format(Parameters!enddate.Value, "MM/dd/yyyy")=Format(NOW(), "MM/dd/yyyy"),
NOW(),
DATEADD("h", 23, DATEADD("n", 59, DATEADD("s", 59, Format(Parameters!enddate.Value, "MM/dd/yyyy")))))

Date and time range where Date() and Date()-1 can't be use in access query

I am trying to set up a query that pulls data from a date field. The date range (for example) that I need is from 3:40 PM of yesterday to today's date up to 3:40 PM. In other words my day does not star at midnight, so the function Date() can't cover it.
I have set up the query as follows:
Between #2/5/2018 3:40:00 PM# And #2/6/2018 3:39:59 PM#
in a field formatted for general Date (mm/dd/yyyy h:mm:ss AM or PM). With this I would have to change the query every day.
I would like to be able to use the function Date() & Date()-1 to replace today's date (Date()) and Yesterday (Date()-1). How can I do it?
I have also tried having two fields one for the Date (formatted as short date mm/dd/yyyy) when the order was entered, and the time the order was entered (formatted for general Date (mm/dd/yyyy h:mm:ss AM or PM). However when I use the function Date() on the date field and >#h:mm:ss# on the Time field the query yields 0 records.
You can do simple calculus with dates and times. Try the following:
Between Date() - 1 + #3:40:00 PM# And Date() + #3:39:59 PM#

Kendo UI DateTimePicker Getting Wrong Time Format ASP.NET C#

I have some records in my database as below:
Note that the StartDateTime and EndDateTime are in 24 hours-system.
But when I display the datetime in my view, the time format is 12 hours-system as below:
From the html code, the value for "1st" End Date Time is correct, but in 12 hours-system:
The dates are used to calculate the amounts. This resulted in wrong number of hours calculated based on the kendoui datetimepicker. Can i know how to solve this?
Here is the JS:
$("#Payment_End_Date_" + count).kendoDateTimePicker({
format: "dd/MM/yyyy HH:mm",
timeFormat: "HH:mm",
interval: 60
});
Change format to
format: "dd/MM/yyyy H:mm",

SQL to query greater than today's date and time, with time defaulting to 12:00:00 AM

Format of the time/date in the table from which I am querying is the following: 11/12/2015 12:00:00 AM.
I would like to be able to query if the date is greater than or equal today, but look for results as the above format. Using getdate() returns the current specific time. Also, the specific format includes two spaces between the date and time.
Thanks for you help.
You can remove the time from consideration as follows:
WHERE CAST(YourDateTime AS DATE) >= CAST(getdate() AS DATE)