Metabase displays wrong time format - metabase

My Data are stored in a MySql Database and i use Metabaseto display the data.
In phpMyAdmineverything looks like it should, but in Metabase the Dates are displayed like they should. The two datetimes types do not really matter but the time type looks like a date altough it's a time.
What can i do so that the time is displayed correctly?
Table Structure:
Table Data:
Metabase:

Try to force date format using DATE_FORMAT/TIME_FORMAT in the output fields list:
DATE_FORMAT(started, '%Y-%m-%d %H:%i:%s') as started,
TIME_FORMAT(testDuration, '%H:%i:%s') as testDuration

Instead of hard coding something, there is a wheel setting button that you can change the format for timing...
and then -->:

Related

Get Date Value as DD/MM/YYYY from database

I am using the "[Datatype(Datatype.date)" data annotation for allowing the user to select the date and it's selected in this format, "DD/MM/YYYY".
However, the date is sent backwards to the database. The image below illustrates this.
Any ideas? Thanks in advance.
Correct date selected
Backwards date sent to data
Ended off using Moment which is amazing at formatting dates.

SOLR Date range

I have to make an ezfind search page with date functions. For the SOLR filter I tried to use something like this: attr_publish_date_dt:[NOW-6MONTH TO NOW] but I don't get any result.
If I use it this way attr_publish_date_dt:[* TO NOW], it works. But all queries without an asterisk on the left hand don't work.
attr_publish_date_dt contains a unix timestamp so I also tried to use 2 timestamps from the attr_publish_date_dt:[* TO NOW] result, instead of [NOW-6MONTH TO NOW], but then I get also no results.
Can anyone help me please? Thanks in advance
Frank
Date searches are supported on a date field. You will need to define a field of that type, and submit dates in ISO-8601 format.
http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/schema/DateField.html
If you cannot properly format the timestamp before sending it to Solr, you may be able to use a DateFormatTransformer or a ScriptTransformer to do the job.
http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer
http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer

Convert multiple gridview date fields into one format

I'm spinning my wheels right now and what I'm pretty sure is an easy answer, I just can't see at the moment. What I'm attempting to do take two sets of converted dates in a database and I want to present them in a grid view as one single date format.
Right now the two date formats are as follows:
YYYYMMDD
mon dd yyyy hh:miAM/PM
I want to convert them all into one format. For giggles, lets just convert them all to 112 (YYYYMMDD).
Now I want to present this all in the same SELECT statement that populates my gridview with other columns of data of various forms lots of text, data entry, long characters, etc.
The thing I haven't been able to wrap my head around is how to put this into a SELECT statement that includes all the rest of the information that populates the gridview.
So a normal SELECT statement (into all nvarchar(max) fields...the table is formed this way because we deal with lots of non standard data importing like Unix) would look like this (this is just a sample database):
SELECT [record_number], [price], [product], [description], [date_of_order], [customer_id] [comments]from sample_database
When presenting the 'date_of_order' field, I figured I need to use a CAST or CONVERT with the proper conversion numbers. However, after looking online I'm scratching my head on how to do this as most of the somewhat relevant information is focused around converting with the GETDATE option instead of leveraging the date that's already written to the database (the information is entered on a different part of the website).
I'm just looking for a pointer or a suggestion in the right direction to use a SELECT statement in my gridview (along with all of the other fields) that can convert any/all of the entries into one common date format. I know I'm missing something simple here but I don't know what.
I should note that I don't want to change them in the Database just when presenting them in the Gridview.
Use the following Convert SQL Function around all of the date fields you require, be warned that this can cause errors if the value is not a correctly formatted date.
CONVERT(datetime, [OldDate], 112)
Found here.
Also look here for more information on the Convert Function

Control input of SQLite attribute to date format only.

I have been reading all about converting TEXT fields into date formats and ways to use Python to create date objects but my question remains.
My table has a dateTime column that is specified as TEXT, I would like to build a constraint that forces input to be in dateTime format, but as SQLite doesn't do dates (as I would like) I haven't worked out how to do it.
My current ideas: 1. Limit number of characters
2. Set separate attributes for day, month and year and constrain their domains
3. It is silly to do this on the database side just do it in the user interface
I would appreciate your opinions on these or other options.
Thanks :)
I've been trying to solve the same issue and the method I came up with was to use the date/time functions to parse the value and check that it hasn't changed. Essentially the following:
CREATE TABLE dts_test (
dts TEXT CHECK (dts IS datetime(dts))
);
If the default format is not what you want you can use the strftime or similar to design whatever format you want, but it must be something that the built-in date and time functions can parse.

Reporting Services: DateTime parameter not showing the time part when its midnight

I need to add a 'StartDate' parameter to a report in Reporting Services 2005, which should represent the current date, at midnight.
If I use Now() as expression, it will correctly use midnight in the calculations, but to the user, the time part will not be shown.
13/12/2011
which can be confusing because then the user doesn't really realise he or she can type in a time part.
How can I format this date to the following:
13/12/2011 00:00
while keeping the parameter as a DateTime datatype.?
Edit: I've checked the duplicate question and tried to apply it to my case, but run into the following phenomenom:
If I try:
=DateTime.Parse(Format(Now().Date().AddSeconds(1), "dd/MM/yyyy HH:mm:ss"))
Then the parameter shows "14/12/2011 00:00:01" which is confusing for the users, so I then tried the following:
=DateTime.Parse(Format(Now().Date().AddSeconds(1), "d/M/yyyy HH:mm"))
But then the parameter shows "14/12/2011" again! In other words, the time part is gone again!
Who invented this stuff? :P
Your formula with .Parse(Format(... causes redundant work that is messing things up. Try this:
=Now().Date().AddSeconds(.001)
Use Format. For example: Format(Parameters!SelectedDate.Value, "d/M/yyyy HH:mm")
Here is a list of DateTime identifiers for use with Format.
Edit:
I get it now, you want 00:00 to show up in the parameter input calendar in the report viewer. The time part won't show up when it's set to midnight. This is by design. If you're using 2005 or earlier, Jamie's solution won't work and you're stuck.

Resources