Convert written out date (DD.MMMM.YYYY at hh:mm apm) string into date value - google-sheets

Unfortunately, the Google-Sheets sync extension saves the timestamp as a string. (Example: February 6, 2022 at 11:40 pm). Is there any way of automatically converting this automatically to an actual date? I tried the usual date conversion formulas but they dont work. Maybe a work-around?

if a timestamp is in cell A2, try this:
=1*SUBSTITUTE(A2,"at","")
This just gets rid of the word "at" and then multiplying by 1 forces an attempt to convert it into a date value. Then you can just do a regular Format>Number>Date and Time on that cell and it should show how you'd want.

Suppose that your string-dates are in A2:A.
Place the following formula into the Row-2 cell of any other open column (e.g., B2):
=IF(A2:A="",,DATEVALUE(REGEXEXTRACT(A2:A,"^(.+),\s"))+REGEXEXTRACT(A2:A,"\d+:.+$"))

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())

how to convert time zone of a datetime in google sheets

I have a column, in which datetime in text format "2022-04-12 07:09:10 UTC". I want to change this into IST time zone and convert it into date format only
You'll need to extract the date and time then add on 5h30m. From there you can either wrap it with INT or format the column to show just the date. For the one below, I used INT, which will strip the time after it is converted.
=ARRAYFORMULA(
IF(ISBLANK(A2:A),,
REGEXREPLACE(A2:A,"UTC","")+
TIME(5,30,0)))

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 to utilize date add function in Google spreadsheet?

I believe the issue I am having now should be much easier in MS Excel. However, since my company uses Google Spreadsheet so I have to figure out a way.
Basically, I have a cell that contains a date value like "12/19/11", and I have another cell contains a value like "DT 30". The task assigned to me is to add the value 30(days) to the date, so the result should be "1/19/2012".
I did some trying in Google Spreadsheet, I have two questions. The first is to how to extract the numeric value "30" out of the string "DT 30", the second question is that, there seems to be no date add function built in Google Docs.
Could any experts offer some suggestions?
I like to keep it simple. If A1 holds the date and B1 holds the number of months to add, then
=date(year(A1),month(A1)+B1,day(A1))
would calculate the required result. The same way could be used for days or years
To extract a numeric value out of your string you can use these 2 functions (Assuming you have your value in cell 'A1'):
=VALUE(REGEXEXTRACT(A1, "\d+"))
This will get you a numeric value.
I've found no date add function in docs, but you can convert your date into internal date number and then add days number (If your value is in cell 'A2'):
=DATEVALUE(A2) + 30
I hope this will help.
You can just add the number to the cell with the date.
so if A1: 12/3/2012 and A2: =A1+7 then A2 would display 12/10/2012
You can use the DATE(Year;Month;Day) to make operations on date:
Examples:
=DATE(2013;3;8 + 30) give the result... 7 april 2013 !
=DATE(2013;3 + 15; 8) give the result... 8 june 2014 !
It's very surprising but it works...
The direct use of EDATE(Start_date, months) do the job of ADDDate.
Example:
Consider A1 = 20/08/2012 and A2 = 3
=edate(A1; A2)
Would calculate 20/11/2012
PS: dd/mm/yyyy format in my example
As with #kidbrax's answer, you can use the + to add days. To get this to work I had to explicitly declare my cell data as being a date:
A1: =DATE(2014, 03, 28)
A2: =A1+1
Value of A2 is now 29th March 2014
Using pretty much the same approach as used by Burnash, for the final result you can use ...
=regexextract(A1,"[0-9]+")+A2
where A1 houses the string with text and number
and A2 houses the date of interest
what's wrong with simple add and convert back?
if A1 is a date field, and A2 hold the number of days to add:
=TO_DATE((DATEVALUE(A1)+A2)
=TO_DATE(TO_PURE_NUMBER(Insert Date cell, i.e. AM4)+[how many days to add in numbers, e.g. 3 days])
Looks like in practice:
=TO_DATE(TO_PURE_NUMBER(AM4)+3)
Essentially you are converting the date into a pure number and back into a date again.
In a fresh spreadsheet (US locale) with 12/19/11 in A1 and DT 30 in B1 then:
=A1+right(B1,2)
in say C1 returns 1/18/12.
As a string function RIGHT returns Text but that can be coerced into a number when adding. In adding a number to dates unity is treated as one day. Within (very wide) limits, months and even years are adjusted automatically.

Resources