Date Extraction from a specific dataset - Google sheets - google-sheets

I've tried all types of date extraction from this timestamp but nothing works.
Data samples:
Mon 2021 Jul 26 2021 8:26 PM
Wed May 19 2021 22:54:00 GMT+0800 (Hong Kong Standard Time)
Tried MOD, = Time,Minute, and Timevalue
Does anyone have any idea?
Tried MOD, = Time,Minute, and Timevalue. Expected to extract the date but it doesn't.

try:
=INDEX(TEXT(IFNA(1*REGEXEXTRACT(TO_TEXT(A1:A),
"(\w+ \d+ \d{4})" ), "​"), "dd/mm/e"))

Use regexextract(), like this:
=to_date( value( regexextract( to_text(A2), "^\w+ (\w+ \w+ \w+)" ) ) )

Related

Why os.time{year=1970, month=1, day=1, hour=0} is not return 0 in Lua?

Im in east 8+ timezone, and this expression return nil on my device.
I know it returned a value counting my timezone infomation. But, Why? I don't get it. How this function implemented and what puporse of it?
Thanks.
Implemention can be found here: https://www.lua.org/source/5.1/loslib.c.html#os_time
os.time is equivalent to mktime in C, the result of the function is dependent on the OS lua is running on.
On Windows, it returns -1 if the local date is before 1970-1-1 UTC. That's why you got nil. (Since Lua 5.3, it throws an error instead). If you call this function on *inx system you can get a negative number.
I am using on Linux often Minus Epoch' for formating Dates/Timelines with os.date()
( My Birthday is before 1970 :-O )
Also os.setlocale()...
> os.setlocale('de_DE.UTF-8', 'time')
de_DE.UTF-8
> os.date('%c', os.time({year=1970, month=1, day=1, hour=0}))
Do 01 Jan 1970 00:00:00 CET
> os.date('%c', os.time({year=1945, month=8, day=6, hour=0}))
Mo 06 Aug 1945 00:00:00 CEMT
> os.date('!%c', os.time({year=1945, month=8, day=6, hour=0}))
So 05 Aug 1945 21:00:00 GMT
> os.setlocale('ja_JP.utf8', 'time')
ja_JP.utf8
> os.date('%c', os.time({year=1945, month=8, day=6, hour=0}))
1945年08月06日 00時00分00秒

Stop ...skipping... SUMMARY OF LESS COMMANDS Commands marked with * may be preceded by a number

When copying some code (about 50 lines) from a rake task to the rails console, I want it to just run the code in the rails console, but instead this happens. The first part is some results printing to screen, but I have no idea what happens next):
#<Appointment:0x00007fb83eec5358
id: "0f0e14a6-1645-4a7b-ad61-f799e60ac570",
doctor_id: 1,
patient_id: 1,
start_time: Sun, 24 Jan 2021 13:25:45 UTC +00:00,
end_time: Sun, 24 Jan 2021 14:25:45 UTC +00:00,
created_at: Sun, 24 Jan 2021 12:50:45 UTC +00:00,
updated_at: Sun, 24 Jan 2021 13:10:45 UTC +00:00]
...skipping...
SUMMARY OF LESS COMMANDS
Commands marked with * may be preceded by a number, N.
Notes in parentheses indicate the behavior if N is given.
A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
h H Display this help.
q :q Q :Q ZZ Exit.
---------------------------------------------------------------------------
MOVING
e ^E j ^N CR * Forward one line (or N lines).
y ^Y k ^K ^P * Backward one line (or N lines).
What is going on and how do I stop it?
Notes:
Here is the full text of what appears
I tried running Pry.config.pager = false as provided here, but the problem happens despite that.

NSDateFormatter localizedStringFromDate dateStyle results

I'm creating this question so I can have a one-shot reference to all the date and time styles for each of the NSDateFormatterStyle enum values NSDateFormatterShortStyle, NSDateFormatterMediumStyle, NSDateFormatterLongStyle, NSDateFormatterFullStyle.
I often find myself in a position where I'd like to know if these default styles are sufficient for my clients, and it's hard to find all the styles in one place.
All the output below is in order 1 = NSDateFormatterShortStyle, 2 = NSDateFormatterMediumStyle, 3 = NSDateFormatterLongStyle, 4 = NSDateFormatterFullStyle. Please feel free to comment if you'd prefer a different organization of output.
English
2015-03-27, 9:42 AM
Mar 27, 2015, 9:42:45 AM
March 27, 2015 at 9:42:45 AM EDT
Friday, March 27, 2015 at 9:42:45 AM Eastern Daylight Time
Note that the Date Formatter separates Date & Time by "," in Short and Medium styles, and by "at" in long and full styles. Interesting!
French
2015-03-27 09:54
2015-03-27 09:54:07
27 mars 2015 09:54:07 HAE
vendredi 27 mars 2015 09 h 54 min 07 s heure avancée de l’Est
No commas at all here. French dates seem to be 24h.
German
27.03.15 09:58
27.03.2015 09:58:07
27. März 2015 09:58:07 GMT-4
Freitag, 27. März 2015 09:58:07 Nordamerikanische Ostküsten-Sommerzeit
Spanish
27/3/15 10:00
27/3/2015 10:00:05
27 de marzo de 2015, 10:00:05 GMT-4
viernes, 27 de marzo de 2015, 10:00:05 (Hora de verano oriental)
Simplified Chinese
15/3/27 上午10:01
2015年3月27日 上午10:01:40
2015年3月27日 GMT-4上午10:01:40
2015年3月27日 星期五 北美东部夏令时间上午10:01:40

Erlang - How Can I Parse RFC1123 Dates Into An Erlang Term?

Without using a third party module, what steps would I need to take to convert this:
<<"Mon, 17 Feb 2014 11:07:53 GMT">>
Into this?:
[17, 2, 2014, 10, 07, 53]
Most of the answers I've Googled suggest using a library.
So far, I suspect I'd get somewhere by pattern matching the formatted date string.
Something like:
<<_:5/binary, Date:2/binary>> = <<"Mon, 17 Feb 2014 11:07:53 GMT">>...
Which I think should produce the following 'match'
Date = 17...
That's based on an idea found here - https://groups.google.com/forum/#!topic/erlang-programming/OpXSqt3U86c - Is this a good approach?
Are there any BIF's or modules that can help with this?
And furthermore, how would I convert/map "Feb" to an integer?
Let's try that in the shell:
1> <<_:5/binary, Date:2/binary>> = <<"Mon, 17 Feb 2014 11:07:53 GMT">>.
** exception error: no match of right hand side value <<"Mon, 17 Feb 2014 11:07:53 GMT">>
Right, we need to match the rest of the binary at the same time:
2> <<_:5/binary, Date:2/binary, Rest/binary>> = <<"Mon, 17 Feb 2014 11:07:53 GMT">>.
<<"Mon, 17 Feb 2014 11:07:53 GMT">>
3> Date.
<<"17">>
So now Date is a binary containing the bytes for the ASCII digits 1 and 7. We can convert that to a number with binary_to_integer:
4> binary_to_integer(Date).
17
As for the conversion of month names to integers, the usual way to do something like that is with a function:
month_name_to_integer("Jan") -> 1;
month_name_to_integer("Feb") -> 2;
...
month_name_to_integer("Dec") -> 12.
You may use tempo library for datetime formatting and parsing.
Bin = <<"Mon, 17 Feb 2014 11:07:53 GMT">>,
L = binary_to_list(Bin),
{match, Res} =
re:run(L, "[0-9]+", [global, {capture, all, list}]),
[list_to_integer(X) || [X] <- Res].
the output is:
[17,2014,11,7,53]
Why suffering? Why not third party module?
I am use erlware_commons
ec_date:parse("Mon, 17 Feb 2014 11:07:53 GMT").

Return Ruby / Rails DateTime or ActiveSupport::TimeWithZone object in requested TimeZone

The user inputs a date range let's say from yesterday with any timezone.
from_datetime = "10/01/2012 00:00 +0545"
I get purchased time for the book like below:
purchased_at = Book.where("created_at > #{from_date}").purchased_at
=> Fri, 08 Jun 2012 09:44:26 UTC +00:00
The problem is this gives me UTC time but I want to show the purchased_at time in the requested time_zone which can vary.
I can't use in_time_zone as the input from_date only has time offset, can I ?
purchased_at.in_time_zone("Kathmandu")
=> Fri, 08 Jun 2012 15:29:26 NPT +05:45
Is there any way around?
Give an offset, you can get a timezone name from ActiveSupport::TimeZone:
> ActiveSupport::TimeZone[5.hours + 45.minutes]
=> (GMT+05:45) Kathmandu
Then you can hand that to in_time_zone:
> Time.now.in_time_zone(ActiveSupport::TimeZone[5.hours + 45.minutes])
=> Thu, 18 Oct 2012 12:33:12 NPT +05:45
You can pull the offset out of the from_datetime with a bit of simple wrangling if you know the incoming format.
There are issues with this approach:
The mapping from offset to name isn't unique.
DST could be a problem if ActiveSupport::TimeZone[] gives you the wrong name.
Depending on your needs, you could just apply the offset manually and ignore the timezone when formatting the timestamp:
> (Time.now.utc + 5.hours + 45.minutes).strftime('%Y-%m-%d %H:%M:%S +0545')
=> "2012-10-18 12:40:12 +0545"

Resources