Compare a date column to today's date in dax im not getting the correct output as required - dax

I have column datetimesent through which I will get to know that the schedule is gone for today, so I'm trying to write if else query where if datetimesent is today's date then schedule running else false.
My existing column is is in date format I need to compare it with inbuilt today/now function, but they are in datetime format, I'm not getting the output correct

You can use DATE() function to build date from your timestamp
for example:
DATE(YEAR([YourTimestampColumn]),MONTH([YourTimestampColumn]),DAY([YourTimestampColumn]))

Related

Filter a field with timestamp (datetime) to get rows that does not contain today's date in Django

I have a Django model with a timestamp field. I want to filter and get the number of rows that does not contain today's date. The timestamp field contains the date, time, and time zone.
I understand that to get rows with today's date, we do the following:
tablename.objects.filter(timestamp__date=date.today()).count()
Thank you.
.exclude returns the inverse of .filter, so it would be
tablename.objects.exclude(timestamp__date=date.today()).count()
Django docs

Can't remove hours and minutes from datatable

I'm trying to get release date field with y-m-d format.. Actually time format (for y-m-d) seems fine but also it gives h:m:s too, I changed time format at server side and removed h:m:s but datatable still shows them
What I get
2012-04-11 00:00:00
What I want
2012-04-11
Released_at field (Metronic theme - json datatable)
{
field: "released_at",
title: "Release Date",
type: "date",
format: "YYYY/MM/DD"
}
time format (I'm using laravel framework)
protected $dateFormat = "Y-m-d";
How do I fix this ?
Datatable accept column type same as mysql type.
You are trying to convert mysql dateTime column to Date in datatable, which is not possible from datatable.
In your code you have declared
format: "YYYY/MM/DD" // but actual type is dateTime as per mysql.So it will append time next to it.
If you are storing only date in mysql then you can change column type to Date, and your problem gets solved.
And if you want to convert string to date in laravel you can follow this post.
Your database column is of type dateTime which, by definition, includes both date and time information. If you want to remove the time at a database level then use the date type instead
$table->date("released_at")->nullable();
If instead of removing the time from the database, you just want to ignore it for certain parts of your application, you can leverage the fact than in Laravel all dates coming from your models are Carbon\Carbon instances, so you could do
$model->releasedAt->format('y-m-d'); // Returns '18-09-11'

Oracle SQL Output to Excel - Date format issue

I ran an SQL Query for Oracle which consists of Invoice date and Check date. When these data are copied on to an Excel Spreadsheet as text, it's dispayed as ex: "13-10-31" (Oct 31, 2013). However, when converted to date format, it's displayed as "10/13/1931". I've tried different date types but it always recognizes as the first part of the text as the day, then month, then year. I need these values to be setup as a date format as I need to calculate Days Payable Outstanding and other related ratios.
Is there any way to convert these values so that Excel recognizes the day, month, and year correctly? Would there be a macro that could automate this process for existing data and data that will be added in the future?
Thank you in advance.
Firstly, I hope the data type of your date column is DATE.
Secondly, the date should always have year as YYYY and not just YY. The world has already learned from Y2K bug.
If above two points are met, then while displaying use to_char(date_column, 'mm/dd/yyyy'). Thus, with YYYY format, there won't be any confusion between year and other fields.

Filter by time and date in Hadoop

I have a table of data which have date and time as two separate field where date format is
dd/mm/yyyy and dd-mm-yyyy and time format is like hh:mm:ss(eg: 6:52:53)
i need to filter the record for a particular time period that both time and date wise filtering.
is there any predefined filter available with hive or pig?
Hive does recognize certain strings as unixtime dates.
You might try a where condition while concatenating the time & date together into unixtime format.
Some documentation on Hive date functions/formats are located here: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions
I suppose you have one column having two date format ie. dd/mm/yyyy and dd-mm-yyyy
What You can try
1) Replacing '/' to '-' so that complete column will be in dd-mm-yyyy format.
2) Try concatanating this field with time field
3) filter it by Casting concatinated field.
Hope this helps.
just possibility :- Have you tried casting that concatenated field to date datatype and then try date functions for desired output ?
eg. to_date()
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF

Report Builder Month Function

In report builder how to filter a date field to get the current month? I'm looking for something equivalent to the Today() function (that gets you just today values).
Actually when I use =field.date.value(Today()), I get today date returned. I would like something like that for the current month instead of the current date.
Try this ,where i am getting the month value from the date of birth field.
=Cstr(Month(Fields!DOB.Value))

Resources