Dates in Table are submitted in incorrect regional format - date

Background Info
I currently have a VBA user form, which submits daily KPIs to an Excel Table in Excel 2010. The Form is setup to put today's date into a text box in the format DD/MM/YYYY (I'm in Australia), then transfer that information to the Excel worksheet when I hit submit. Previously, this process has worked without a hitch, as it is just transferring pure text. But now, the date is being submitted in US format (MM/DD/YYYY). I'm pretty sure the problem is somewhere in Excel, but here is my VBA code anyway:
'First it populates the text box
Private Sub UserForm_Activate()
TextBox1.Text = Format(Now(), "DD/MM/YYYY")
End Sub
'Then it transfers to the spreadsheet
With nwb.Sheets("daily_tracking_dataset_master")
.Cells(emptyRow, 1).Value = TextBox1.Value
Main Problem
Somewhere on the Excel side, the data is now being submitted incorrectly in the US date format, so a submission on the fourth of June, becomes the sixth of April, see image: http://tinypic.com/r/2vslyd5/8/.
When i change the number format to General, it shows that the pure text date from the VBA form has been converted to the April date. I.e. it's not a simple matter of changing the formatting, the date has actually been completely changed:
41789 (30/05/2014)
41789 (30/05/2014)
41789 (30/05/2014)
41735 (06/04/2014)
41735 (06/04/2014)
41735 (06/04/2014)
I have tried several workarounds for this, including:
Highlighting column A and changing the format to Date in the format DD/MM/YY
Selecting Date format under the Home tab -> Number group -> Date drop down box
Checking regional settings in Windows and Excel
I have also tried going into Data -> Data Tools -> Text to columns. Then on step 3 selecting DMY under Date - this seems to be one of the main fixes for the issue I'm having in other forums.
By the nature of the Excel Table, each time my submission form adds a record, the table is extended by one row - I'm not sure whether this would have any influence and the incorrect date settings are generated from the Table somehow?
Any ideas for troubleshooting this would be fantastic.

You need to use CDate when writing back to the cell to convert the text to a real date value so that VBA can't misinterpret it:
.Cells(emptyRow, 1).Value = cdate(TextBox1.Value)

Related

Date Format in Power BI Hierarchical Slicer

I have a Power BI file that connects to a data model via SSAS. The data model origin is a SQL Server view with some computed columns added in via SSAS.
One of the visualisations is a Hierarchical Slicer that shows dates. The field is not one of the computed SSAS columns. It displays in DD/MM/YYYY format but when I place the file on a Power BI Report Server the format is Americanised to MM/DD/YYYY. I want it to be DD/MM/YYYY.
The same field is used to populate a table visualisation but in there it remains DD/MM/YYYY. Just the slicer is affected.
This blog https://community.powerbi.com/t5/Desktop/date-format-in-slicer/td-p/215627 seemed to have the answer I needed but these settings were already applied and still the slicer shows MM/DD/YYYY.
Its not a problem when I open the pbix file locally; there, the slicer shows the dates as DD/MM/YYYY, its just when its on the server. The same problem persists in Test and Production and I have checked those settings and they are as the blog indicates. Other blogs identify this with the slicers but do not present a real solution as its not seen as a problem in those topics.
I've only spent a month working with Power BI so have no real experience to draw upon. I know that SQL Server defaults to American English when connecting to a database and I have changed that to British English but still the same problem. How do I get the slicer showing as DD/MM/YYYY as in my local copy?
Select the Date column and then go to the Modeling tab and change Format to whatever Date format you want.
OR
You can create a calculated column using the FORMAT method in DAX to convert date format as you want.
See reference here: https://msdn.microsoft.com/en-us/library/ee634398.aspx
Power BI is missing the formatting in their recent releases. However, the below solution works for me:
Create a Calculated Column ref. the original Date column and apply "Short Date" format for Date, example:
Transaction Date =
FORMAT(DATE(
YEAR([Transaction_Date]),
MONTH([Transaction_Date]),
DAY([Transaction_Date])
), "Short Date")

Tableau String to Date Time Format Issues

I am pulling in date information via MySQL and the date is in the string format of "MM/dd/YY hh:mm:ss"
Using the built in conversion to date isnt working; so I tried using DATEPARSE and also using DATE and manually parsing it. I have had no luck and I have no idea why I keep getting "null" as the answer or it is putting the month as year, day as month, and year as day.
See screenshots below for the different formulas I have used:
DATEPARSE
Original date format
DATE with manual parsing
This worked for me using your example original data
DATEPARSE('mm/dd/yy hh:mm:ss',[Time] )
I used tableau's documentation of custom date formats to find the right formula for the format.
If this doesn't solve the problem then it is most likely due to a Locale issue. The Dateparse function relies on the locale specified by your computer settings to interpret and then display the strings you want to convert and can affect whether a certain format can be specified. This means that if a certain format is not recognised it will return a null. This will often occur is the windows region and language format is changed to another language other than the original language the workbook was created it.
So check your locale and if required execute the following workaround (documented by tableau here):
Open Windows control panel > region and language > format
Click format dropdown and change to original language of workbook creation
click ok or apply and reopen tableau work book

Format to enter a Date in Google Forms

I have a drop-down list of dates I want users of a form to select from. I have tried mm/dd//yy, mm/dd/yyyy, yyyy-mm-dd, yyyy/mm/dd and MMM-DD-YYY, but the data that ends up in the Sheet is always 12/31/1969 (25568.6666666667 if I change the display format). What format can I use to get a date successfully imported?
The answer in this thread didn't work for me: What format is required to import a date into google spreadsheet
The format mm/dd/yyyy works; I had a problem in the naming of the columns of the spreadsheet which was the source of the problem.

Date format issue while uploading and saving the excel sheet into db using coldfusion cfspreadsheet

I uploaded and parsed through an excel sheet using cfspreadsheet and inserted all the values into database and the problem is that [my excel sheet has a date range from 1/2/2016 to 29/02/2016,from 1/2/16 to 12/2/2016 it is right aligned in excelsheet and remaining is left aligned...]. The value is being inserted into the db but I cannot able to fetch the values from 1-12 using where condition in db. I tried manually changing the date format in my excel sheet..what happened is
..02 January 2016
02 February 2016
.
.
02 December 2016
13/02/2016
14/02/2016
.
.
up to 02/12/2016[mm/dd/yy] it is displaying dd as month notation and from 13/02/2016[dd/mm/yyy] it is displaying properly, I tried with all formatting options, and I need to implement it in code. I think while downloading the data itself the date is not getting formatted properly, I tried with different excel sheet but of no use...and I tried converting these dates into specific format using coldfusion code and but it doesn't works for me..
<cfset sheet = spreadSheetRead("D:\file123\final1231.xls")>
<cfset SpreadSheetFormatColumn(sheet,{dataFormat="yyyy-mm-dd"},3)>
<cfset SpreadSheetWrite(sheet,"D:\file123\final1232",true)>
can any one help me in this?
What looks to me is that locale is set to 'English (United States)' in your excel and that is why for first 12 rows your excel is treating values as valid date but starting 13th row the data is invalid and hence excel is treating it as string (hence left aligned). Try manually changing excel locale to 'English (India)' or similar and you will see data aligned properly.
Also Cold Fusion internal date-time format is American (mm/dd/yyyy) and by default will interpret date and time into American format. I think while inserting data you can create date with something like below to make sure what data gets inserted:
#createDate(listLast(dt,"/"),listFirst(listRest(dt,"/"),"/"),listFirst(dt,"/"))#
Here dt is the data column that you want to insert. You may need to put some checks, based on the data, to avoid any run time errors.

Convert Date Value When Using Google Form Date Picker from 5 Digit Format to MM/dd/yyyy format

I selected tomorrow's date (8/21/2014) from the data picker field of a Google Form submission, and the value "41872" is returned in the spreadsheet.
What format is this date format?
I need to convert this date format to the MM/dd/yyyy format using script, as formatting the Date column using the Format menu only updates the rows that are currently available...not the new rows that will be there when new form submissions come in.
How do I make this conversion?
I am not sure, but your issue seems to be very basic. Its about the cell formatting as like we do in Ms Excel.
For Google spreadsheet inorder to format a cell or a range,
1. Select the Range
2. On menu, Go To Format->Number->Date (and then select the required format)
Does this works?
I had the same confusion. All you need to do is just change the format from the menu Format->Number->Date & Time