Is formula can extract long space date from text string? - excel

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.

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

Changing format of TODAY() in excel

I'm using today to aquire todays date and then adding a static value to the end of it using the following:
=TODAY()&"T23:00:00"
Which Returns 43202T23:00:00
I really need it in the format 2018-04-12T23:00:00
Any help on this would be great!
There are a couple ways to accomplish this, depending on whether your goal is a formatted String (to display) or a numeric value (such as data type Date) for storing or using with calculations.
If you want a formatted date/time result (to display to the user)...
Use the TEXT worksheet function:
=TEXT(TODAY(),"yyyy-mm-dd")&"T23:00:00"
...the reason this works is because TODAY() returns a Date data type, which is basically just a number representing the date/time, (where 1 = midnight on January 1, 1900, 2 = midnight on January 2, 1900, 2.5 = noon on January 2, 1900,etc).
You can convert the date type to a String (text) with the TEXT function, in whatever format you like. The example above will display today's date as 2018-04-12.
If, for example, you wanted the date portion of the string displayed asApril 12, 2018 then you would instead use:
TEXT(TODAY(),"mmmm d, yyyy")
Note that the TEXT worksheet function (and VBA's Format function) always return Strings, ready to be concatenated with the rest of the String that you're trying to add ("T23:00:00").
If you want to use the result in calculations...
If you instead want the result to be in a Date type, then instead of concatenating a string (produced by the TEXT function) to a string (from "T23:00:00"), you could instead add a date to a date:
=TODAY()+TIME(23,0,0)
or
=TODAY()+TIMEVALUE("23:00")
..and then you can format it as you like to show or hide Y/M/D/H/M/S as necessary with Number Formats (shortcut: Ctrl+1).
More Information:
MSDN : TEXT Function (Excel)
MSDN : TIMEVALUE Function (Excel)
MSDN : TIME Function (Excel)

How to a convert a string in this format "20180101" into a date value like 01/01/2018 in Excel? [duplicate]

This question already has answers here:
Changing YYYYMMDD to MM/DD/YYYY
(5 answers)
Closed 4 years ago.
What formula can I use to transform the string into a date value that will appear as 01/01/2018?
If you are trying to do this from a formula into another cell, and not in situ (For which, use "Text to Columns" as per Jeeped's answer), you can either combine DATE and MID, or use REPLACE and convert with +0 or DATEVALUE:
=DATE(MID(A1,1,4), MID(A1,5,2), MID(A1,7,2))
OR
=REPLACE(REPLACE(A1,7,0,"-"),5,0,"-")+0
OR
=DATEVALUE(REPLACE(REPLACE(A1,7,0,"-"),5,0,"-"))
(Where A1 is the date to convert)
The first formula just cuts the number up into 2018 01 01 and uses those as Year, Month and Day. The second 2 work by first Inserting (i.e. REPLACE 0 characters) a hyphen at position 7 ("201801-01") and then at position 5 ("2018-01-01") and converting the string back to a number/date.
Use Data, TextToColumns, Fixed width, Date: YMD, Finish. Possibly Date: YDM depending on your string date format (you provided an ambiguous example).
use the code below
=RIGHT((text),2)&"/"&MID((text),5,2)&"/"&LEFT((text),4)
Use the DATEVALUE() function which takes as input a text format. Not that if your output cell is not in Date format you will see a simple int insteade of the expected 1/1/2016.
I refer you to the DATEVALUE function documentation for more insight on the input format and so on

Formatting magento timestamp to readable excel format

I download invoice reports from my magento website. They hold a date format I am not able to change to a standard date format. This is what it looks like: 1 aug. 2016 15:24:08
What formula can I use to have excel change it to a format like 13-08-16 (Dutch Format) ( I don't need the time for the moment).
Assuming that your 3 letter month names end with a dot in magneto data, you can use this where original data is in cell A1
=TEXT(SUBSTITUTE(LEFT(A1,FIND(".",A1)+5),".",""),"dd-mm-yy")
Check if "1 aug. 2016 15:24:08" is:
a\ pure string (String Type data; "wroted" date)
or
b\ string representation of Date type data (formatted date)
.

Making Excel Recognize Custom Day/Time Format

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.

Resources