Tableau reading dates in wrong format - datetime

I have a csv file with time column as "2022-02-08 00:00:27" (February 08th 2022) but when I import the csv file and set the date column as "date" type , "2022-02-08 00:00:27" gets intrepreted as (August 02nd 2022) .
How do I set the date format ?

Change your workbook locale from the file menu. Failing this you could build a new date field from the actual date, just reversing the components.
Steve

Related

Convert day of the month(char) to date format in R

I run the following code in R studio and it worked fine in converting the 'start_dt' to date type and saving the output to a new column named 'date'.
all_data_cl$date<-as.Date(all_data_cl$start_dt,format="%d/%m/%Y")
I wanted to extract the day of the month from the resulting date and store the output in a new column named 'day',for that I wrote the following code:-
all_data_cl$day<-format(all_data_cl$date,"%d")
Though the 'all_data_cl$date' was in date format,the 'all_data_cl$day' is coming out to be a char type object rather than a date.
See Output Image
Can someone guide me on how to fix that?
Try this :
format(as.Date(df$x,format="%Y-%m-%d"), format = "%d")

phpspreadsheet German date format

How can i set the german date format with phpspreadsheet?
If i set the cell to ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY) it will be displayed in Excel to Screenshot Excel date format 1
If i use ->setFormatCode(\PhpOffice\PhpSpreadsheet\StyleNumberFormat::FORMAT_DATE_YYYYMMDDSLASH) Excel read a date but set locale to Africaans
Screenshot Excel date 2
How can i set a German date (dd.mm.yyyy) correct with phpspreadsheet?
Thank you
Othmar
Use a string value instead of the built-in constants:
->setFormatCode('DD.MM.YYYY')

date time format in SAS that can't be exported in Excel 2007

Good Morning,
A program in SAS is about to select/merge/sort dates/times in alphanumeric value (ex : 14-Jan-2013 07:00:00.479) inside a lot of tables and to create a single table.
This program use the instruction "format E8601" and several lines after "format type $10.;
informat type $10.;", what transforms the dates in a numeric value (ex : 2013-01-14T07:02:03.647).
When this table is exported in Excel 2007, the value becomes " " and can't be modified in a traditional date/time format.
How to do it ? Is there any other format (instead of E8601) which can be used to keep the date in text or in a alphanumeric value ?
Thanks for your help.
SAS datetime values are internally represented as floating point values equal to the number of seconds since January 1, 1960. FORMATS are used to control how those numeric values are externally represented. For example, consider this:
data have;
myDateTime1 = '14-Jan-2013 07:00:00.479'dt;
myDateTime2 = '14-Jan-2013 07:00:00.479'dt;
myDateTime3 = '14-Jan-2013 07:00:00.479'dt;
format myDateTime2 datetime23.3
myDateTime3 E8601DT23.3;
put myDateTime1= 'as a number'
/ myDateTime2= 'as a normal SAS datetime'
/ myDateTime3= 'as an ISO 8601 datetime'
;
run;
When run, this is shown in the SAS log:
myDateTime1=1673766000.5 as a number
myDateTime2=14JAN2013:07:00:00.479 as a normal SAS datetime
myDateTime3=2013-01-14T07:00:00.479 as an ISO 8601 datetime
Note the three myDateTime variables have the same value but are displayed differently based on the format specified.
Assuming you have SAS Access to PC File Formats licensed, you can just use PROC EXPORT to create an Excel workbook:
proc export data=have
outfile='c:\temp\test_dates.xlsx'
replace;
run;
The data values in the Excel workbook for the two variables formatted as "datetime" values will appear correctly as Excel columns. However, the default formatting in Excel only shows the "date" portion; to display the complete value in Excel you will need to change the Excel column formats.

Upload Excel file which row contains date time format but not show

I have an excel file with one column data in datetime format. When I upload my file datetime format does not match those and file could not be uploaded.
Has Hitesh mentioned you can check the Column and check if it is a DateColumn. Once confirmed we can check the next steps.
You will need to format the Date column in your excel. Just select the whole column - > right click - > format cells - > Date -> choose appropriate format.

SQL Developer: Load Data Date error

I am using Oracle SQL Developer 3.0.03. I am trying to upload an Excel file to an Oracle data table. I am getting an error for the date. The column in the database is a timestamp and I don't know what to put into the date format for the 'Data Load Wizard'. If I use the following format (dd-mom-yy hh.mi.ss), SQL Developer will show the following error:
--Insert failed for row 1 TIMESTAMP_COLUMN GDK-05047: A day of the month must be between 1 and the last day of the month.
--Row 1
INSERT INTO TABLE_1 (Column1, Column2, Column3, TIMESTAMP_COLUMN) VALUES ('Some Text','Some Text','Some more text',to_timestamp('40604.0', 'dd-mon-yy hh.mi.ss'));
The default number format IN EXCEL is: 40604.0
Which if you change the cell to a short date format you will get: 3/2/2011
I am trying to figure out what 'Format' I need to put into the FORMAT section of the 'DATA Load Wizard' that will accept the date format that is in EXCEL and upload it to Oracle as a TIMESTAMP.
I ran into the same thing today, and 'fixed' this two ways. The second way probably seems too complex, but it might help someone if they have a hard time automating the formatting of dates to look like Oracle's standard dd-mmm-yy.
Format the date columns in Excel as dd-mmm-yy and import directly into the table.
Highlight the column(s)
Choose "More Number Formats" where the existing format is (In Excel 2010, it says General in a dropbox on the Home tab
Select the last entry "Custom" in the Category box
Manually enter dd-mmm-yy in the Type: box
Format the date columns in Excel as mm/dd/yy, import the table in as text, write a manual insert statement from the temp text table using TO_DATE(date_field,'MM/DD/YYYY')
Highlight the column(s)
Choose "More Number Formats" where the existing format is (In Excel 2010, it says General in a dropbox on the Home tab
Select the "Date" entry in the Category box
Choose "03/14/01" from the list
The Excel "zero" date is January 0 (yes, zero), 1900. Since Oracle can't handle a "zero" day in a month you need to subtract 1 from the Excel value; thus the following should get you close to what you want:
SELECT CAST(TO_DATE('01-JAN-1900 00:00:00', 'DD-MON-YYYY HH24:MI:SS') AS TIMESTAMP) +
NUMTODSINTERVAL(41017.6361109954 - 1, 'DAY')
FROM DUAL
As far as "how to import it" goes, there's no Oracle date format that I'm aware of to do this. The easiest thing would be to import the value into a NUMBER column and then run a script to do the date conversion.
Share and enjoy.
yeah and that's the problem.
"A day of the month must be between 1 and the last day of the month."
1) how are these decimals created?
2) is this "04-06-2004" ? or are these seconds from 1970?
you need to add more detail about this number format!

Resources