Trying to extract the date from the written string Thursday, Aug 25, 2022 2:00 PM-2:30 PM which should result in a date value of Thursday, Aug 25, 2022 2:00PM (or any date & time format).
Assuming the string is located in cell G2, I tried =TRIM(MID(G2,FIND(" ",G2),FIND(" ",G2,FIND(" ",G2)+1)-FIND(" ",G2))) and all I get is: Aug.
try:
=REGEXEXTRACT(A1, "\b[A-z]{3} \d+. \d+\b")
Related
I am looking for a formula that will automatically convert a column of ordinal date/time values into standard date/time values.
July 1st 2022 6:48:49 pm
July 2nd 2022 10:03:35 am
July 3rd 2022 5:41:12 pm
July 4th 2022 2:44:13 pm
I need to get those reformatted to eliminate the st, nd, rd, and th portions.
Sheet
You can use
=INDEX(IF(A2:A7="",, REGEXREPLACE(A2:A7,"st|nd|rd|th","")*1))
You can then format as you like
(Do adjust the formula according to your ranges and locale)
Functions used:
INDEX
IF
REGEXREPLACE
In googlesheet, I have a timestamp in this format
March 12, 2021, 9:54 PM
I need to split it to
2021-03-12
And in another column:
9:54 PM
Is there any way to do it?
If you are using US locale for GS then use following formulas for date:
=TEXT(INDEX(SPLIT(A1,","),,{1,2}),"yyyy-MM-dd")
and for time:
=TEXT(INDEX(SPLIT(A1,","),,3),"h:mm AM/PM")
I'm working with a Grails application and I can't find a clear way to translate a date from one TimeZone to the next/previous TimeZone available (I will define what I consider the next/previous Timezone below).
The facts:
I'm working with date filters in a Grails Application so we can retrieve information based on those filters. The application supports TimeZone so the logged user can set his profile to a particular Timezone.
The dates of the filter are on UTC format and the information on the database is stored also on UTC.
The question:
The user logged has his profile on Timezone UTC+00.
There is a predefined date filter called "This Week", when a user clicks on it generate a period of dates corresponding to the current week in UTC so we can bring all the information on the database from the current week.
If we are on the current day (Thu 19 Nov 2015) the dates the filter will generate for "This Week" to look on the database would be:
Sun Nov 15 00:00:00 UTC 2015 to Sun Nov 22 23:59:59 UTC 2015
This is correct and will bring all the information on the database on that period.
Now, suppose the user doing this has set a Timezone UTC +01.
If we are on the current day (Thu 19 Nov 2015) the dates the filter will generate to look on the database would be the same period:
Sun Nov 15 00:00:00 UTC 2015 to Sun Nov 22 23:59:59 UTC 2015
But in this case I need to translate them to a correct TimeZone because the "This Week" for the current user won't be the same for a user on UTC +01 this is because for this user the date Sun Nov 15 00:00:00 would correspond to the date
Sun Nov 14 23:00:00 on the UTC time (since he/she is one hour ahead) and therefore when filter by "This Week" I should search on the database by the dates:
Sun Nov 14 23:00:00 UTC 2015 to Sun Nov 22 22:59:59 UTC 2015
The thing is I have created a method utcDateToUserTZ(date) to translate from an UTCDate to LocalTimeZone date but this would convert the UTC dates:
Sun Nov 15 00:00:00 UTC 2015 to Sun Nov 22 23:59:59 UTC 2015
into
Sun Nov 15 01:00:00 UTC 2015 to Sun Nov 23 00:59:59 UTC 2015
And that is not what I'm looking for. I need those dates to be translated to the previous TimeZone.
I hope no to be walking around with an issue that has a simpler solution, in which case I hope you can tell me if there exist something easier to solve this.
Thanks,
The method commented before is:
public DateTime utcDateToUserTZ(Date date) {
TimeZone profileTimeZone = getCurrentUserProfile().timeZone
DateTimeZone dateTimeZone = DateTimeZone.forTimeZone(profileTimeZone)
return new DateTime(date, dateTimeZone).withZone(dateTimeZone)
}
I have a really big spreadsheet in google docs. I have a collumn with time in UTC format. For instance (2013, 10, 14, 12, 17) for 14 Oct 2013, 12:17 am
I want to change it to ISO 8601. I have started to change them one by one, but the data is huge. Is there any other way to do it automatic?
If you want to turn (2013, 10, 14, 12, 17) (assumed in A1) into a more conventional format:
=SPLIT(mid(A1,2,len(A1)-2),",")
to populate B1:F1 then:
=date(B1,C1,D1)+(E1+F1/60)/24
to convert to a date time index recognised by Google Sheets. The result might be formatted:
dd MMM yyyy, HH:mm AM/PM
to show: 14 Oct 2013, 12:17 PM
or formatted otherwise by choice (ISO 8601 does not require a unique format).
This does not attempt to address any strange convention for the likes of 12:17 (ie treats that as 17 minutes after noon, not after midnight) nor any time difference due to location.
I'm having trouble with event timezones in the start_time and end_time fields in the event FQL table. I want to show the timestamp in a formatted date that accounts for the user timezone. Empirically, it appears the timestamps are in the PST timezone, so I convert them to GMT and add the user timezone, as contained in the timezone field in the user table. Conversion to GMT is performed by Java, with the following code (this should account for daylight saving time automatically):
long millis = 1000 * timestamp;
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
int offset = tz.getOffset(millis);
long timestampGMT = millis + offset;
However, this approach produces different results than the Facebook site.
For example I have an event with start_time=1317416400 and a user with timezone=2. Converting to GMT and adding the user timezone I get September 30th 2011, 16:00:00, but the Facebook site shows September 30th 2011, 14:00:00.
How can I obtain the correct (as in FB site) result?
Examples:
Summer:
http://www.facebook.com/event.php?eid=234094353309432
Created by a user on GMT+2
Time shown on the site: Friday, September 30 · 2:00pm - 7:00pm
start_time (from FQL): 1317416400
If it was UTC, then: Friday, September 30th 2011, 21:00:00 (GMT)
If it was PDT (with DST, so GMT-7), then: Friday, September 30th 2011, 14:00:00 (GMT-7)
Winter:
http://www.facebook.com/event.php?eid=254174591293234
Created by a user on GMT+2
Time shown on the site: Sunday, December 25 · 1:00pm - 4:00pm
start_time (from FQL): 1324846800
If it was UTC, then: Sunday, December 25th 2011, 21:00:00 (GMT)
If it was PST (no DST, so GMT-8), then: Sunday, December 25th 2011, 13:00:00 (GMT-8)
Thanks