I have been connecting Tableau to a csv data source. I have two date columns. When I tell Tableau they are date columns it imports the entirety of both columns as Nulls. I tried to import them as strings and create a calculated date column out of each with DATEPARSE.
I ran this ([Close Time] is the string from the CSV)
DATEPARSE("mm/dd/yyyy hh:mm:ss",[Close Time])
and named the column "Close_Time_DT"
The result was:
Close Time
'05/30/2013 11:20:50'
'05/30/2013 18:01:53'
'06/05/2013 02:02:49'
Close_Time_DT
'1/30/2013 11:20:50 AM'
'1/30/2013 6:01:53 PM'
'1/5/2013 2:02:49 AM'
Clearly this is wrong, I tried also with
DATEPARSE("m/d/yyyy hh:mm:ss", [Close Time])
and got the same result.
Thanks in advance for your help
I had a similar problem. My source csv format for dates was date/month/year (07/01/2015). When I used Dateparse function i first entered it as
DATEPARSE("dd/mm/yyyy",[ServDate])
but it did not properly handle the month and would make it July or in one case put all the dates in the same month (january).
What finally worked was to use:
DATEPARSE("d/M,y",[ServDate])
Related
I'm creating a ms-access query to filter by month. I have my list of dates, filter by month using Month(8) as criteria in the field, and am getting a data type mismatch error. I'm not putting the number in quotation marks and I know the field I'm adding criteria to is in MM/DD/YYYY format because I'm pulling it from a query where I changed it to that format. I'm sure it's a simple fix but I am VERY new to ms-access. Thank you in advance for your help.
I'm pulling it from a query where I changed it to that format.
That is your trouble. Pull the date field as is, not as a formatted string.
Then this SQL will work:
Select * From YourQuery
Where Month([YourDateField]) = 8
Sorry Guys, I need some help doing this for a datefield in SSRS. I have a spreadsheet that I export as an xml file, then use that xml as a datasource for my dataset in SSRS. The field for the date comes through as 42969 instead of a Date 22/08/2017. I am not sure how to convert this in ssrs to a date using an expression. Does anyone have an idea?
You can convert this quiet simply but as the data has come from Excel you need to adjust the date by 2 (Excel and SSRS/VB.NET treat serial dates differently).
The following should work
=DateAdd("d", Fields!MyDateField.Value -2, "1900-01-01")
i'm trying to specify dd/mm/yyyy dateformat for date/time parameter in SSRS 2008 R2.
My computers datetime format is mm-dd-yyyy.
My requirement is, i want to show date format at dd/mm/yyyy irrespective of the system/server date format.
I've already tried CDate(Format(Today,"dd/mm/yyyy")) which didn't work. one very strange thing i observed is, it shows dd/mm/yyyy format only for dates on or before 12-MM-yyyy, and 13 onwards it gives error: Conversion from string '25-04-2014' to type Date is not valid. (Possibly it is trying to map 25(daypart) with MM-dd-yyyy (month part)) which is out of range of total months i.e. 12)
my research on internet says it is a bug in BIDS 2008.
What do i do to display date as dd/mm/yyyy ??
I don't have enough reputation to comment, but I did notice that you failed to put "()" after "Today". If I'm not mistaken you must put Today() for that function to work. Also, you might want to try putting CDate Around the Today() function. You shouldn't need it, but it's worth a shot. Also, for some odd reason, in my experience, you must capitalize MM for format to work correctly.
Like #Aditaya said, it should be =format(Today(),"dd/MM/yyyy")
The expression I usually use is:
=FormatDateTime(Fields!Date.Value, DateFormat.ShortDate)
However, this may be region specific.
Rather than writing an expression to do the formatting, you can also use the Textbox Format Property. But first you need to make sure that the data is in a date format. So use the CDate function on your column like this:
=CDate(Fields!Date.Value)
Then in the textbox properties go to the Number tab. Select Date for the category. Then you can select whichever format you want or use a Custom format. This will change how the column displays when you run the report.
I have a MS Excel file in which a column contains date in the format m/d/yyyy and mm/dd/yyyy. I wanted all these dates to be imported in to a MySQL table.
So in MS Excel, I changed the cell format to custom date 'yyyy-mm-dd' and everything looked fine in the excel columns. When I exported it as .csv, all dates were in the original format i.e., m/d/yyyy and mm/dd/yyyy but not as 'yyyy-mm-dd'.
Please help me in this regard. Thank you!
Like David mentioned, you may have to replace the text before importing it to the MySQL table. You can try this formula:
=TEXT(A2,"yyyy-mm-dd")
And copy down. Then do a copy->Paste Values into the original date column. Then delete the temporary column with the Text() formula.
Try importing it after you replace the text. It should work out.
I need current month name as default perameter name in my ssrs report. How can I get current month name using an ssrs expression?
For example "27-09-2012" would become "September"
and one more i need....
27-09-2012 to previous month name as well (August)
First question:
=MonthName(Month(Fields!datefield.Value))
Second question:
=MonthName(Month(DateAdd("m", -1, Today())))
I think the second question answer might be something like that, first converting the date to month then subtracting 1 from the month value and then converting it to month name.
Further reading:
SSRS Reports get Month name from Month Index or from date
Converting month number to month name in reporting services
OFF: I would change the date format you are using to 2012-09-27 as it works in every setting and should give you peace of mind when converting date formats.
Don't subtract 1 b/c it won't work for January.
Use this:
MonthName(Month(DateAdd("m", -1, CDate(Today))))
As a note, I tried the suggestion of =MonthName(Month(today())). What I would get is #error for whatever field the expression was in. However, =MonthName(str(Month(today()))) worked for me. I am unsure of whether or not the MonthName method changed to require a string or if it is some issue with my program. Just figured I would post this in case anyone else was having the same issue.
For Previous Month i found universal way : =MonthName(Month(CDate(Today()))-1,False) for SEPTEMBER (Full Month Name) 'OR'
=MonthName(Month(CDate(Today()))-1,True) for SEP (Short Month Name)