Making Excel Recognize Custom Day/Time Format - excel

I'm working with a date and time format from the Twitter API. It looks like this:
Tue Nov 26 20:44:15 +0000 2013
Is there a formula to convert this to a format that could be sorted chronologically? I don't need the +0000. Also not concerned about the day of week.

=DATEVALUE(MID(A1,9,3) & MID(A1,4,5) & RIGHT(A1,4)) + TIMEVALUE(MID(A1,11,9))
Then format as you like. As requested you would want a Custom Format of mmm dd HH:mm yyyy

Try this, assuming that your string is in A1:
=DATETIME(MID(A1, 5, 16) & MID(A1, 27, 4))
The two MID formulas cut out the parts of the string you want, namely the month, day, time, and year, but exclude the day of the week and the timezone. This produces a string that the DATETIME function can automatically recognize and covert into a native Excel date format.

Related

Trouble converting a text string to date in Notion

I'm trying to convert a text string into a date in Notion to build a birthday reminder system in my database.
Bigger picture, I want a database view with the birthdays that are coming up in the next month. Some people I know their actual date of birth, and for others I only know their birthday. I enter the birthdate for the people whose birth year I don't know as the current year.
The filters allow you to select a date relative to the present, but not a date whose anniversary is coming up. So to fix this, I am creating a field that reformats the birthdate as a date in the current year, and filtering based on that.
I successfully built the new date, but it is a text string. In order for the filters to work, it needs to be formatted as a date.
I tried formatDate but that gives me an error.
For example:
formatDate(concat(prop("Birthday"), ", ", prop("thisYear")), "MMMM D YYYY")
Gives error:
Type mismatch concat(prop("Birthday"), ", ", prop("thisYear")) is not a Date.
It appears formatDate only reformats an existing date, it doesn't convert a string into a date. I can't find a function that converts a string into a date. How would one do that?
to convert the date you have in text format into a prop date, you have to start from 01 Jan 1970, this is the date Notion use to refer every single date into ms.
With this formula you will have 01 Jan 1970 from now:
dateAdd(dateSubtract(dateSubtract(dateSubtract(dateSubtract(dateSubtract(now(),
year(now()) - 1970, "years"), month(now()), "months"), date(now()),
"days"), hour(now()), "hours"), minute(now()), "minutes"), 1, "days")
Now you have to add to this date months, year and days you have into your birthday prop.
To do this you simply have to use he dateAdd formula, so you will have:
dateAdd(dateAdd(dateAdd(dateSubtract(dateSubtract(dateSubtract(dateSubtract(dateSubtract(now(),
year(now()) - 1970, "years"), month(now()), "months"), date(now()),
"days"), hour(now()), "hours"), minute(now()), "minutes"),
prop("Giorni"), "days"), prop("Mese") - 1, "months"), prop("Anno") -
1970, "years")
You have to consider that in my example, prop("Giorni"), prop("Mese") and prop("Anno") are already numbers.
If you have them into a text field you first have to extract them with the slice formula and convert them into number with toNumber formula.
I hope I helped you, sorry for my English but I'm not native English speaker.
Bye

Is formula can extract long space date from text string?

i have do the research all over the internet but most of the references is about dd/mm/yy or dd.mm.yy but i want something like dd mmmm yyyy (between are using space)
and i have tried to used
=MID(A1,SEARCH("?? ????? ????",A1),13)
to extract the date from the text string but it will error in some cell such as display the text not date.
my date will be in 2 type below:
on (1 April 2020)
on 1 April 2020
if on has CONCAT and FILTERXML:
=CONCAT(IFERROR(FILTERXML("<a><b>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,")",""),"(","")," ","</b><b>")&"</b></a>","//b[starts-with(following::*[1],"&{"'Jan'","'Feb'","'Mar'","'Apr'","'May'","'Jun'","'Jul'","'Aug'","'Sep'","'Oct'","'Nov'","'Dec'"}&")]"),""))&" "&CONCAT(IFERROR(FILTERXML("<a><b>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,")",""),"(","")," ","</b><b>")&"</b></a>","//b[starts-with(.,"&{"'Jan'","'Feb'","'Mar'","'Apr'","'May'","'Jun'","'Jul'","'Aug'","'Sep'","'Oct'","'Nov'","'Dec'"}&")]"),""))&" "&CONCAT(IFERROR(FILTERXML("<a><b>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,")",""),"(","")," ","</b><b>")&"</b></a>","//b[starts-with(preceding::*[1],"&{"'Jan'","'Feb'","'Mar'","'Apr'","'May'","'Jun'","'Jul'","'Aug'","'Sep'","'Oct'","'Nov'","'Dec'"}&")]"),""))
Note: this returns the string. If one wants a true date then:
=--(CONCAT(IFERROR(FILTERXML("<a><b>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,")",""),"(","")," ","</b><b>")&"</b></a>","//b[starts-with(following::*[1],"&{"'Jan'","'Feb'","'Mar'","'Apr'","'May'","'Jun'","'Jul'","'Aug'","'Sep'","'Oct'","'Nov'","'Dec'"}&")]"),""))&" "&CONCAT(IFERROR(FILTERXML("<a><b>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,")",""),"(","")," ","</b><b>")&"</b></a>","//b[starts-with(.,"&{"'Jan'","'Feb'","'Mar'","'Apr'","'May'","'Jun'","'Jul'","'Aug'","'Sep'","'Oct'","'Nov'","'Dec'"}&")]"),""))&" "&CONCAT(IFERROR(FILTERXML("<a><b>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,")",""),"(","")," ","</b><b>")&"</b></a>","//b[starts-with(preceding::*[1],"&{"'Jan'","'Feb'","'Mar'","'Apr'","'May'","'Jun'","'Jul'","'Aug'","'Sep'","'Oct'","'Nov'","'Dec'"}&")]"),"")))
And format the date as desired.

converting a twitter date string into a datetime field in excel

I have a number of excel strings in the format "Mon Nov 25 17:20:47 +0000 2019"
I found an earlier post that recommended using =DATE(RIGHT(O2,4),MONTH(DATEVALUE(1 & MID(O2,5,3))),MID(O2,9,2)) to create a usable date field. However, this drops the time which is an important piece of information.
How can I include the time with the date in order for excel to recognize and sort all the information included in the field?
Thank you in advance!
You can just use the same logic with the date formula, but use TIME instead of DATE and of course extract the correct time into the formula =TIME(MID(O2,12,2),MID(O2,15,2),MID(O2,18,2))
Edit:
to combine them both in one field, you will need to add them =DATE(RIGHT(O2,4),MONTH(DATEVALUE(1 & MID(O2,5,3))),MID(O2,9,2)) + TIME(MID(O2,12,2),MID(O2,15,2),MID(O2,18,2))
The rationale of this is because:
Date is expressed in whole numbers i.e. 1 = 01/01/1900, 2 = 02/01/1900, 3 = 03/01/1900... 43794 = 25/11/2019, etc.
Time is expressed as a fraction of the day i.e. 0.5 = 12 hrs/12PM, 0.66666 = 16 hrs/4PM, etc.
so lets say you have 1/1/2019 12.00 PM, the date part that gives 1/1/2019 will be 43466 and the time part will be 0.5. Adding them together will give you 43466.5, and when converted to a date time format it will show as 1/1/2019 12:00 PM.
You can use string functions to create an unambiguous date string, then turn it into a date/time value with a mathematical operation (adding the time value in a string form).
=(MID(A1,9,2)&"-"&MID(A1,5,3)&"-"&RIGHT(A1,4))+MID(A1,12,8)
You'll need to format the result as something appropriate: eg: dd-mmm-yyyy hh:mm

Date format English / French

I have this kinf of date format :
Mon, Nov 19, 2018
And I want it in a french short date format (DD/MM/YYY)
But i can't resolve it with basic date format with excel.
Any ideas ?
You can use MATCH to return the correct month:
=DATE(RIGHT(A1,4),MATCH(TRIM(MID(A1,FIND(" ",A1)+1,3)),{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},0),MID(A1,FIND("}}}",SUBSTITUTE(A1," ","}}}",2))+1,2))
To convert your text into a date, you can use this formula (assuming the date in text format is in cell C15):
=DATE(RIGHT(C15,4),IF(EXACT(MID(C15,6,3),"Jan"),01,IF(EXACT(MID(C15,6,3),"Feb"),02,IF(EXACT(MID(C15,6,3),"Mar"),03,IF(EXACT(MID(C15,6,3),"Apr"),04,IF(EXACT(MID(C15,6,3),"May"),05,IF(EXACT(MID(C15,6,3),"Jun"),06,IF(EXACT(MID(C15,6,3),"Jul"),07,IF(EXACT(MID(C15,6,3),"Aug"),08,IF(EXACT(MID(C15,6,3),"Sep"),09,IF(EXACT(MID(C15,6,3),"Oct"),10,IF(EXACT(MID(C15,6,3),"Nov"),11,IF(EXACT(MID(C15,6,3),"Dec"),12)))))))))))),MID(C15,10,2))
Then you get an Excel date that is easier to work with.

How to convert a text name format to excel date?

I have a column that has a name date: Friday, December 25, 2015
and I want to convert it to a date format: 12/25/2015 , that way I can perform other date functions.
I have unsuccessfully tried both changing the format directly and using the =DATEVAL() function.
Any direction would be great. thanks
First remove the day names
Ctrl+f and just replace "Friday," or "Saturday," or other days with ""
now your columns should be formatted like
"December 25, 2015"
Now use the dateval function like
=DATEVALUE("December 25, 2015")
Now select date from formatting and you should be good.
With text in A1 use:
=DATEVALUE(MID(A1,FIND(", ",A1,1)+2,9999))
and format as a Date:

Resources