Small question regarding Tableau and the DATEPARSE function please.
I used to have a CSV, nothing special, that has a column Mytimestamp.
The values of the column Mytimestamp would be just like those: Mytimestamp 1628670242328 1619671382146
DATE(DATEPARSE ( "yyyy-MM-dd HH:mm:ss", STR(DATEADD('second', (INT([Mytimestamp]/1000)), #1970-01-01#)) ))
Again, this worked really great, no problem.
Now, we have couple of other data sources, and I just replaced the original data source, the CSV file, to those new datasource.
Unfortunately, all dashboard using this broke, with this issue.
"Unknown function DATEPARSE called".
May I ask how to fix this, and get the behavior I was having with the CSV please?
What would be an alternative to this DATEPARSE function which can help "convert" those timestamps into a human readable format.
Thank you
The correct answer is to use DATETIME
DATE(DATEPARSE ( STR(DATEADD('second', (INT([Mytimestamp]/1000)), #1970-01-01#)) ))
Some data sources, such as CSV, supports DATEPARSE
But some others does not, and the DATETIME is the answer.
Related
I am inserting dates that look like:
'19APR2014:08:42:32.123456'
I am interpreting their format as
'DDMONYYYY:HH24:MI:SS.FFFFFF'
Though I have not seen any times after 12:59:59 I am assuming a 24-hour clock. Hive does not seem to understand what I want to do:
HiveException: Error evaluating unix_timestamp(date_string,'DDMONYYYY:HH24:MI:SS.FFFFFF')
Any ideas what I am doing wrong or what might be wrong with my format string?
Have you tried ddMMMyyyy:HH:mm:ss.SSS? According to Hive manual a pattern string in function unix_timestamp(string date, string pattern) should comply to Java's SimpleDateFormat(see manual and javadocs).
I am facing an issue with Talend dates. I have tried several solutions but still an "unparseable date" error persists.
My date format is of the form : "2006-05-27 17:00:00.000"
Can you help me ?
you can use below talendDate function to parse your string into date..
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss.sss","2006-05-27 17:00:00.000")
this would take input as string and return you date.
If you don't handle the conversion yourself in a tMap but just want to use a schema, then: In your mapping configuration in the date field, you can add the following string:
yyyy-MM-dd HH:mm:ss.SSS
to set the correct format mapping for the date string. Otherwise the answer of garpitmzn is the way to go.
you should use this function in talend to fetch date:
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss.SSS","2016-01-12 12:45:00.000")
With the help of "stackoverflow" and it's users I'm using an app to import data into a Google spreadsheet. The problem is I have a date question on the form, and can not manage to import it. If I change the format (in the forms) to text, the data imports as it has been sent from the app, but when I change it back to date, nothing.
I've believe I've tried all the usual date formats (dd/mm/yyyy, mm/dd/yyyy, yyyy/mm/dd, yyyy/dd/mm) as well as yy for the above and also numerical.
I know that the Google form shows the date in the users format and that is not a problem. It shows up correctly in the spreadsheet in my local format (dd/mm/yyyy).
Does anyone know what format the form uses to send the data to the spreadsheet, or anyway to find out.
Thanks in advance.
Ok, after using wikipedia, and trying every different format it works by using the format yyyy-mm-dd
Here's a screenshot:
Here's a screenshot http://www.coletrumbo.com/wp-content/uploads/2015/05/dateformat-1024x575.png
I'm trying to turn the current date into July 1st of the current year using DATEFORMAT(). I learned how to do that in MySQL from this question, and I hoped it would work similarly in Jaspersoft Studio- turns out date_format( curdate(), '%Y-07-01' ) doesn't translate into
DATEFORMAT( TODAY(), '%Y-07-01' ) or DATEFORMAT( TODAY(), YY/07/01 ). Neither worked.
I could keep trying to get creative and hopefully find something that works, but I'd rather actually understand how to use DATEFORMAT().
I checked the Jaspersoft Studio User Guide, but it's not there. From the prompts on the screen, it makes a lot of sense, but I just can't figure out the "format pattern" that I'm allowed to apply, or even how to correctly write any format pattern at all. Also, this conveniently named question, DateFormat Pattern, didn't actually help at all. And community.jaspersoft.com/answers is kind of a joke in my opinion. When I checked it a couple days ago, it was filled with spam linking to live hockey games.
Thanks in advance. I'm sure this is a beginner level question, so I feel dumb asking it, and I feel like I'm wasting other people's space and time with it because I should already know. So I really appreciate your willingness to care.
I am using the following to get the todays date in a danish format
"Dato: "+new java.text.SimpleDateFormat("dd MMMM yyyy",new
Locale("da", "DK")).format(new Date())
you can find the source code for the DateTime functions directly in JR repository: https://sourceforge.net/p/jasperreports/code/ci/master/tree/jasperreports/demo/samples/functions/src/net/sf/jasperreports/functions/standard/DateTimeFunctions.java
As you can see the code is fairly simple and relies on the Joda Time library.
Therefore the second parameter you are trying to enter is a String, while the first one is a Date object.
Indeed something that could work for you is an expression like this DATEFORMAT(TODAY(), "07-01-YYYY")
Regards,
Massimo.
I have this HW question that is asking me:
Write a SAS Program to creates a data set that contains test date closest to
delivery date. Your program must work for any test date and delivery date.
Here is what I have done so far. The data sources are in seprate sheets in excel which I p pulled in and merged and there is only 1 deliver date and 21 test dates. I figure the best way to find the closest day was the absolute value of the smallest difference, then use proc sort because that is the only proc command we are allowed to use other than proc import and export. Any ideas/help/whatever would be appreciated thanks.
proc import datafile = "C:\Users\file1.xls"
dbms=xls replace out=labs; sheet = "labs";;
run;
proc import datafile = "C:\Users\file1.xls"
dbms=xls replace out=delivery; sheet = "delivery";
run;
data dl;
merge delivery labs;
dd = delivery_date;
diff = dd - Test_date;
run;
Here is the data they are both in 1 column didn't know how to format that here.
Sheet 1:
delivery_date
11/16/2011
Sheet 2:
Test_date
13-Mar-11
10-Apr-11
20-May-11
9-Jun-11
31-Jul-11
17-Aug-11
12-Sep-11
10-Nov-11
11-Oct-11
12-Dec-11
29-Feb-12
13-Mar-13
10-Apr-10
20-May-10
9-Jun-10
21-Jul-11
15-Aug-11
15-Sep-11
19-Oct-11
21-Nov-11
22-Dec-11
It sounds like you are on the right track. Given that this is homework, I'm not going to give you a complete solution, but here are some components you may find helpful:
First, you should look at the SAS website for more information about the absolute function (since that is the route you want to take):
SAS/IML(R) 9.3 User's Guide: ABS Function
Next, you may want to review the documentation for PROC SORT. It will be useful for finding the smallest difference.
For getting only one record, you may find the OBS Data Set Option helpful.
(Hint: you may need to create a second dataset.)