I have some dates in Text format and some other in Date format.
I tried so many things to reconvert them in proper format. DD/MM/YYYY
16/10/2022
05/12/2023
24/05/2023
I still cant figure out. They all looks in Date format but some are not. How i can re-format properly. There is sample of my dates.
https://docs.google.com/spreadsheets/d/1aNsoqXnpNkQs7LloFuHVObARqI2QEh5X8ClCu42ICyQ/edit?usp=sharing
How i can fix this?
Here's what happened :
you had a bunch of dates formatted as DD/MM/YYYY and pasted them and they were automatically parsed in the format MM/DD/YYYY leading some of them being recognized as proper dates (but not the ones you intend to have), and some of them being leaved as text.
To solve this you can copy paste the column in a text file, then import this file; when you import the data in excel, use the "text to columns" to choose the date format.
You can also change your locale date settings.
Last solution that does not involve creating a new file : copy paste your dates in a text file, add a ' in front of each line which ensures the cell content is not automatically interpreted, then parse the date from this text using the formula :
=date(right(H2,4),mid(H2,4,2),left(H2,2))
(if your text is in h2)
One last thing : some of your data in the left column is not in the correct format. You probably have a formatting problem / data quality problem in the source data you copy/pasted from.
save file in CSV or convert to csv
Open as text
Use the Text import wizard from paste
Related
In an Access form, I need to use the date output from a date picker field to be used to search for a file in a form. However, the default data format seems to only allow slashes. Although I know the date is being stored as a number in the database.
Put simply, I need Me.myDate to output a legal file name structure, for example, yy-mm-dd. Then I can concatenate that with my file name to search for myfilename_yy-mm-dd
I always get myfilename_yy/mm/dd which is of course unusable as a file name.
Changing the format of the field obviously makes no difference to how the value is stored. What I don't understand is if the date is stored as a number, and the output is shown in the selected format, how I can override the default formatting behaviour used when I query the date.
The Format Function will allow you to format the date as you wish.
An expression to include the formatted date in a filename pattern could look like this ...
"myfilename_" & Format(Me.myDate, "yy-mm-dd") & "*"
I have an text entry control with the input mask 00/00/0000. However it comes into the data table as just a string of numbers, e.g. 05132015. I have the datatype in the schema set to short text with a format of mm/dd/yyyy. Actually, I don't understand the difference between the format (set in the table design mode) and the input mask. Just my ignorance. I don't have a short date data type in the drop down list. In short, I want to have the user enter a short date in the format mm/dd/yyyy and have it show up in the datasheet view with the slashes.
Edit:
I'm having the same problem with running times with an input mask 00:00:00.
Edit:
I found out that I can specify shortened versions of the DateTime datatype. That will do the trick. However, in the short term, is there a way to use an input mask and still have the delimiter come through?
I have huge amounts of raw data that are separated by columns. All is well when i import these to Matlab except for the fact that I just saw that the excel files contains different formats for the dates.
One series (i.e 3 days, 1 row or each hour gets 3x24 rows) have its' dates in the format "mm/dd/yyyy" which neither excel or matlab recognizes as proper dates.
I've tried solving this problem in different ways. First i tried to just highlight the cells and use the function format cells, but this didn't work since excel doesn't see them as 'cells' but rather as 'text'.
Then i tried the Text to columns function which didn't work either (delimited or fixed width).
Im really stuck and would appreciate some help with this.
In Excel:
If cell A1 has a string like mm/dd/yyyy then try this:
=DATE(RIGHT(A1,4), LEFT(A1,2), MID(A1,4,2))
In Matlab:
=datenum(yourDateString, 'mm/dd/yyyy')
Select the desired range to fix and use this script:
Sub bulk_Date_fix()
on error resume next
Set d_ranged = Selection
For Each a In d_ranged
a.Value = Split(a.Value, "/")(0) & "/" & Split(a.Value, "/")(1) & "/" & Split(a.Value, "/")(2)
Next
on error goto 0
End Sub
How it works: The above script loops through all the cells in the selected area and splits out the various attributes of a date based on the "/" symbol.
I examined your file and you will need to go back to the source data to straighten this out. Instead of "opening" the file in Excel, you will need to IMPORT the file. When you do that, the text import wizard will open, and you can then designate the date column as being of the format DMY (or whatever format is being generated by the source).
The problem is that there is a mismatch between the format of the file, and your Windows Regional Short date format. If you look at Row 229, you will see that real dates are present, but out of sequence with the rest.
Excel parses dates being input according to the Windows Regional Short Date settings. If the date doesn't make sense, according to that parsing (e.g. month > 12) , Excel will interpret the date as a string; if the date does make sense, it will be interpreted as a date in accordance with that windows regional date component order, and this will be different from what is intended.
So the first few hundred dates are strings, but at line 229, the date, which is probably meant to be 12 OCT 2014, gets changed to 10 DEC 2014. This will happen in other areas where that value in the 2nd position is 12 or less.
EDIT: I am not certain of the variabilities inherent in using XL on the MAC. In the Windows version of XL, the "text import" feature is on the Data Ribbon / Get External Data Tab:
When you click on that and open a text file, you will see the Text Import Wizard, and when you get to Step 3, you will be able to specify the text format of the data to be imported:
I've been playing with MIT AppInventor and attempted to calculate a duration between two dates.
I take date values from two text fields. Clock.MakeInstant says it's only able to accept dates in MM/DD/YYYY format so I was careful to do that. Still, when I attempt to feed them into MakeInstant it always pops the same message about being able to only accept MM/DD/YYYY hh:mm:ss or MM/DD/YYYY or hh:mm. I printed entered text values before passing them to MakeInstant to confirm that they are not somehow corrupted and they are fine -- each just a date in MM/DD/YYYY format.
I have no idea what else to try. As far as I can tell I followed the instructions to the letter. Any examples on how to pass a date as text to Clock.MakeInstant?
see this screenshot source: https://groups.google.com/d/topic/app-inventor-shared-utilities-repository/3bA4wczU9pU/discussion
Taifun
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Open Xml and Date format in Excel cell
I'm trying to take data from a DataGridView and generate an Excel file with the contents. I have a problem with dates though.
The problem is that, having written the worksheet, saved and opened it in Excel, my date cell has a date value in it and, if I do "Format cells", has the format I requested, yet Excel hasn't applied that format. For example, if I export the date value using ".ToOADate()", I get something like "40690.5270454051" in the cell. If I click into the cell, and then out again, the correct formatting is applied.
I've tried omitting the "ToOADate" call, and the same thing happens (I get a recognisable date value, but only formatted using my custom format after I click in and out of the cell).
I've tried setting the DataType of the OpenXml.Spreadsheet.Cell object to CellValues.Date (or EnumValue(CellValues.Date)) but then I get an error about "unreadable content" when I try and open the xlsx file.
Thanks,
Ross
What you need to do is set a value that is a floating point number (number of days since Jan 1, 1900 or 1904 - there is a setting in the file to decide which). The hh:mm:ss is the fraction part of the number.
You then set the cell format to be the datetime format you want. Excel will then display the number as the formatted date. This is how Excel stores all dates.
What I think is happening in your case is you are setting the value to a string. When you click on the cell, Excel parses the string, sees that it can be turned into a date, and then saves it as the floating point value.
Save the file after clicking and then look at the cell contents to see the difference.