How to force DateTime field in Quicksight on string column? - datetime

I have a data set that has dates like so:
datetimecreated
2019-09-14 06:06:15.863383
2019-09-14 06:06:16.863385
When I go to edit my data set and force column datetimecreated into datatype date time, I get error:
Known date formats were not detected in this data. Provide a date format to transform this data into a known date format.
The data format I am trying to pass is this:
yyyy-MM-dd HH:mm:ss.ffffff
What am I doing wrong that this can not be detected as date field by Quicksight?
I've even tried this format:
yyyy-MM-dd HH:mm:ss
get same error as above.

First check would be if the date format is accepted in quicksight:
Quicksight User Guide pg.71
I don't think "yyyy-MM-dd HH:mm:ss:SSSSSS" is an accepted format.
In which case you may want to just extract the datetime data from the string to the most relevant format so that is usable for your analysis.
To do so you can create a calculated field based on your "datetimecreated" field using the parseDate() function:
parseDate(date, [format], [time_zone])
It's possible to create a calculated field either in the "Edit Data" section of the dataset by selecting it the dropdown menu for the "datetimecreated" field in the field list OR by selecting the option in the "Add" menu within a specific analysis.
Inserting your data into the formula would look something like this:
parseDate({datetimecreated}, yyyy-MM-dd HH:mm:ss, [time_zone])
This should create a date field with the extracted date information that you can then manipulate as with any other date and aggregate by DAY, MONTH etc.

I had this issue, I used this page for that correct formats:
https://docs.aws.amazon.com/quicksight/latest/user/parseDate-function.html
The format I required was yyyy-MM-dd'T'HH:mm:ssZ

Correct format is yyyy-MM-dd HH:mm:ss:SSSSSS

Related

Format Date via Parameter

I have a DateTime variable (default formatting), and I would like to format it to a format to I receive from a string parameter.
I normally do something similar to: {myDate:yyyy-MM-dd}, and it works properly.
Now I have a lot of possible date formats and need to format according to the chosen one.
I have tried the following but returned garbage (ae0aor0aa):
string testFormat = "yyyy. MM. dd.";
{myDate:testFormat }
I have also tried to convert the date to string and back to date with ParseExact, but gave me an invalid date exception. NB: the date in myDate is valid, as I have checked it with the debugger.
Can you kindly advise?
Thanks to apc, it was easily solved by myDate.ToString(testFormat)

How to change UK date format in LogicApp

Im trying to convert a U.K. input date (dd-MM-yyyy) to format (yyyy-MM-dd)
I tried
"#formatDateTime('15-03-2019','yyyy-MM-dd')" ==> Error
but got error:
'In function 'convertTimeZone', the value provided
for date time string '15-03-2019' was not valid. The datetime
string must match ISO 8601 format.'
How do I go about converting this input date? The input format is (dd-MM-yyyy) and cannot be changed.
I can easily convert from (MM-dd-yyyy) as shown below, but im not able to convert from (dd-MM-yyyy)
"#formatDateTime('03-15-2019','yyyy-MM-dd')" ==> OK
Date and time functions provided by azure logic app cannot recognize the timestamp in dd-MM-yyyy format.
After my research, there is no existing function that can directly solve this problem, but you can use substring and concat to deal with this problem.
The workflow of the logic app looks like this:
The expression of the formatDataTime:
formatDateTime(concat(substring(<your-date-string>,6,4),'-',substring(<your-date-string>,3,2),'-',substring(<your-date-string>,0,2)),'yyyy-MM-dd')

Convert date to other format other than YYYY-MM-DD

I need to convert input date coming in format YYYY-MM-DD. First I convert it into char by following:
TO_CHAR(<date_column>,'YY/MM/DD')
then try to convert it into date for this format:
to_date((TO_CHAR(<date_column>,'YY/MM/DD')),'YY/MM/DD')
As to_date always converts to default date type of YYYY-MM-DD. What other way can I use to convert this into other format. I am using Informatica Powercenter, so I can not find other function other than TO_DATE.
I think we are ignoring basics - to_date() converts to a date format. Now it can be displayed in dd/mm/yyyy depending on setup in your DB client or if you are dumping in a file probably YYYY-MM-DD. And on a date filed you cfan use TO_CHAR o convert it to any format.
So, if your input is a string and is in 'YY/MM/DD' then use TO_CHAR(TO_DATE(imp_yymmdd,'YY/MM/DD'),'DD/MM/YYYY') - output will be a string of your desired format i.e. DD/MM/YYYY.
If your input is a date then use TO_CHAR(imp_date,'DD/MM/YYYY') - output will be a string of your desired format.
Date datatype has no format. You can format a string representing a date.
Assuming your input is date, just use TO_CHAR(yourdate, 'desiredformat').
If your input is a string, you first need to convert it to date then back to string again, with the desired format applied. So:
TO_CHAR(TO_DATE(yourstring, "format-it-comes-in"), "desired-format")
Which in your case would be:
TO_CHAR(TO_DATE(yourstring, "YYYY-MM-DD"), "YY/MM/DD")

How to obtain string date from xml and convert in a correct format in ax?

I am trying to obtain a date from an XML file that is in this format:
2016-10-27
however, the field I am trying to put it in is in this format:
mm/dd/yyyy
is there a code for this in dynamics ax 2012? I tried str2date but it doesn't output anything.
SOLVED: Just to let you guys know even though you are obtaining a string that has a format like mine 2016-10-27 AX automatically formats it to the default format to 10/27/2016 just input the sequence correctly. (THIS IS NOT PART OF THE ANSWER I AM JUST EXPLAINING MY FINDINGS)
You will need to use str2date(string _date, int _sequence). Specify the related format in sequence. Your desired format will be 213

convert date/time to hours in quickbase

Example: created a record on date 07/19/2016, 10:00AM, I wanted it to be converted into hours(timestamp) and display as 54 hours in quickbase. Appreciate your help
If you want to convert a timestamp into the hours in a formula field you can do it with the ToTimeOfDay() and Hours() functions. Say you want to display the hour only of the Date Created field you can put this formula into a formula-numeric field:
Hour(ToTimeOfDay([Date Created]))
If you need to use a formula - duration field for some reason, just put all of the above through the Hours() function:
Hours(Hour(ToTimeOfDay([Date Created])))

Resources