GoogleFinace convert dd/mm/yy to yy,mm,dd format - google-sheets

I am trying to use blew expression in Google SpreadSheet.
=min(GoogleFinance("HKDUSD","price",date(A2)-1,date(A2)))
But since A2 data is in mm/dd/year format, we need to convert it to yy,mm,dd format as parameter of date().Does Google SpeadSheet has some API to do such convert?

It actually works if you just add the dates as they are without the date function wrapped around them
=min(GoogleFinance("HKDUSD","price",L1-1,L1))
Edited: To answer your follow up question about the date format - a formulaic workaround you do uses regex replace and basically just swaps the two capture groups in month and day with this regex "(\w+)/(\w+)":
=min(GoogleFinance("HKDUSD","price",REGEXREPLACE(L1,"(\w+)/(\w+)","$2/$1")-1,REGEXREPLACE(L1,"(\w+)/(\w+)","$2/$1")))

Related

Conditional Formatting doesn't recognize timestamp?

i am using a code for timestamp link here.
The issue is when i am trying to condtional format the row base on date i.e today it isnt working =$A1=today() what might be the issue
Conditional Formatting doesn't recognize timestamp?
you can find the sample sheet here link
The dates are calculated as a counting from 30/12/1899. For example, 29/12/2022 is expressed as 44924:
The hours, minutes and seconds are expressed as a fraction of a day:
So, as suggested you should keep the INT part or ROUNDDOWN the value of the TIMESTAMP in order to match TODAY's date (that is an integer without decimals):
=INT($A1)=TODAY()
=ROUNDDOWN($A1)=TODAY()
can you try:
=INT($A1)=today()
try:
=($A1*1<=TODAY()+1)*($A1*1>TODAY()-1)
or:
=INT($A1)=TODAY()
and see: https://stackoverflow.com/a/66201717/5632629
timestamp upon range edit:
=LAMBDA(x; x)(IFERROR(B1:1/0)+NOW())

Date Conversion in Google Sheets

I am struggling to convert a bunch of dates in Google Sheets.
My dates are in the format mentioned in this image.
Some dates have AM/PM in them, while some have a / instead of a -.
I need to convert them to yyyy"-"mm"-"dd" "hh":"mm":"ss while converting the time to 24hour format in case of PM.
Does anyone know a way to achieve this?
The problem is that most of your data uses the American date convention m/d/yyyy while your spreadsheet uses the Indian d/m/yyyy date convention. But then again, some of the data appears to already be in the ISO8601 format you are requesting as the result format. To convert all the dates, use this:
=arrayformula(
if(
isnumber(A2:A) + isblank(A2:A),
A2:A,
regexreplace(A2:A, "^(\d+)/(\d+)/(\d+)(.+)", "$3-$1-$2$4") + 0
)
)
Format the result cells as Format > Number > Date time or as the custom format you mentioned. See the new Solution column in your sample spreadsheet.
Suppose your raw data is in A2:A. Clear B2:B and place the following into B2:
=ArrayFormula(IF(A2:A="",,IFERROR(DATEVALUE(A2:A&"")+TIMEVALUE(A2:A&""),DATEVALUE(A2:A)+TIMEVALUE(A2:A))))
This formula has error control built in, to handle the raw data if there is a mix of strings and real date-times.
Next, select the entire Column B. Apply Format > Number > More Formats > Custom number format and enter the following in the text field at the top: yyyy-mm-dd hh:mm:ss

Convert string timestamp mm/dd/yy hh:mm:ss to a date/time type in google sheets

Row 1: cell A is a concat of the date in B and the time in C. I generate these with CTRL+: and CTRL+SHIFT+: respectively. Google sheets does not treat this like a timestamp on the x axis of charts
Row 2: I discovered CTRL+ALT+SHIFT+: to do a full timestamp, now it has a real timestamp
The issue is, I have many rows of recorded data of the type in Row 1 -- is there any way to convert this into a 'time' format that Google Sheets will respect on the x-axis of charts? Using VALUE() just gives the date portion of the timestamp.
Kind of crazy how much trouble this is causing me, is there really no date_parse(string_format) type function I can call?
EDIT:
this is ridiculous, just going to export and use python
instead VALUE use TIMEVALUE and then format it internally to time
or:
=TEXT(TIMEVALUE(A1); "hh:mm:ss")
for arrayformula:
=ARRAYFORMULA(IF(A1:A="",,TEXT(TIMEVALUE(A1:A); "hh:mm:ss")))
for timestamp > date use DATEVALUE

How do I pull the month from text strings in this Twilio format 2019-08-22 06:12:58 MDT?

I am using the Twilio log file to crunch some data and need to convert the Twilio format for dates into something that Google Sheets can recognize as a date so I can then extract what month the date is referring to. I think that first, the text string has to be converted to be a better format and then I can use one of Google Sheets functions to extra the month. Currently, this is the format in the log file:
"2019-08-22 06:12:58 MDT"
I used GoogleSheets TIMEVALUE and TEXT functions.
=TIMEVALUE(I2)
and
=text(I2,”mmmm”)
I get "Formula Parse Error"
The timezone stamp is messing up the Google formulas for you.
So you may want to try getting rid of that with something like this:
=text(index(split(I2," "),,1),"mmmm")
The split function breaks up the logged time stamp into 2019-08-22 | 06:12:58 | MDT across three columns.
And the index function then gets the just the first column - the date bit from there.
And then the text function gets the month name out of the date.
you can use:
=TEXT(LEFT(A1, 10), "mmmm")
and in array it would be:
=ARRAYFORMULA(TEXT(LEFT(A1:A, 10), "mmmm"))

conversion of date in erlang

I developed a function in erlang which return date in this form for example: 15-Dec-2011
I want to convert this date in order to became in this case 15-12-2011 (so DEC became 12)
this is an example of date that should be converted
15-Dec-2011
19-Jan-2012
16-Feb-2012
15-Mar-2012
19-Apr-2012
17-May-2012
I will give basically the same answer with this post as the last post asking how to convert dates in erlang.
The easy solution is to use the ec_date or dh_date.
convert date in erlang
ec_date:format takes the format argument in a way similar to php's date function.

Resources