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])))
Related
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
I need to take a full timestamp column (Format: YYYY-MM-DD HH:MM:SS.SSSS) and convert it into hourly timestamp (Format: YYYY-MM-DD HH:00:00)
For example:
I want to convert my existing date:
2016-02-26 04:00:07.766304000
into:
2016-02-26 04:00:00
I tried to use unix_timestamp() and from_unixtime() function but it is too confusing :X
Does someone know how to easily do it?
Many Thanks for the helpers :)
You can use to_date() to get the date of the time and hour() to get the hour of the time, and then concat them together if you do not want to use unix_timestamp() or from_unixtime().
Suppose 'submit_time' looks like '2016-02-26 04:00:07.766304000'.
concat(to_date(submit_time),' ',cast(hour(submit_time) as string),':00:00')
will gives the answer.
My problem: I need to get date format as "mm/dd/yyyy"
Scenario:
I have declared DateBirth as nullable DateTime.
The value I get when I use:
AdvancedObj.DateBirth .Value.ToString()
is: "13/03/2013 00:00:00"
The value I get when I use
AdvancedObj.DateBirth .Value.ToString(CultureInfo.InvariantCulture)
is :"03/13/2013 00:00:00"//This is roughly correct but, I do not need 00:00:00
I have tried this as well, but the format is correct and value is incorrect.
AdvancedObj.DateBirth.Value.ToString("dd/mm/yyyy",CultureInfo.GetCultureInfo("en-Us"))
**"13/00/2013"**
Can anybody point me, what am I missing?
Use the right format string for months - it is MM. mm is for minutes:
AdvancedObj.DateBirth.Value.ToString("MM/dd/yyyy",CultureInfo.InvariantCulture)
Also, order them correctly as above - if you want months before days, use MM/dd/yyyy, if the other way around, dd/MM/yyyy.
I suggest you take a good long read of Custom Date and Time Format Strings on MSDN.
Month are 'M'. 'm' is for minutes.
"dd/MM/yyyy"
I have a column with elapsed time values in it and they are formated as hh:mm:ss or mm:ss. I had no control over this as the data was imported.
What I need to do is find a way to do a global update to change the values to seconds or find a way to use the sum function on the column in its current format.
One problem is that the data is a mix of mm:ss and hh:mm:ss. The hours field was not zero padded.
The statement
SELECT
SUBSTR(SUBSTR("0000000"||time,LENGTH(time),8),1,2)*3600 +
SUBSTR(SUBSTR("0000000"||time,LENGTH(time),8),4,2)*60 +
SUBSTR(SUBSTR("0000000"||time,LENGTH(time),8),7,2)
FROM
table
WHERE
...
should work with mix of hh:mm:ss, h:mm:ss, mm:ss, m:ss, ss and s formats and also the time separator should be any character.
I'm trying to do a query like this on a table with a DATETIME column.
SELECT * FROM table WHERE the_date =
2011-03-06T15:53:34.890-05:00
I have the following as an string input from an external source:
2011-03-06T15:53:34.890-05:00
I need to perform a query on my database table and extract the row which contains this same date. In my database it gets stored as a DATETIME and looks like the following:
2011-03-06 15:53:34.89
I can probably manipulate the outside input slightly ( like strip off the -5:00 ). But I can't figure out how to do a simple select with the datetime column.
I found the convert function, and style 123 seems to match my needs but I can't get it to work. Here is the link to reference about style 123
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.blocks/html/blocks/blocks125.htm
I think that convert's slightly wrongly documented in that version of the docs.
Because this format always has century I think you only need use 23. Normally the 100 range for convert adds the century to the year format.
That format only goes down to seconds what's more.
If you want more you'll need to past together 2 x converts. That is, past a ymd part onto a convert(varchar, datetime-column, 14) and compare with your trimmed string. milliseconds comparison is likely to be a problem depending on where you got your big time string though because the Sybase binary stored form has a granularity of 300ms I think, so if your source string is from somewhere else it's not likely to compare. In other words - strip the milliseconds and compare as strings.
So maybe:
SELECT * FROM table WHERE convert(varchar,the_date,23) =
'2011-03-06T15:53:34'
But the convert on the column would prevent the use of an index, if that's a problem.
If you compare as datetimes then the convert is on the rhs - but you have to know what your milliseconds are in the_date. Then an index can be used.