How to convert string to date BigQuery 2023-02-13 00:00:00.000000000 - string

Help me please! I have date to string fotmat in
2023-02-13 00:00:00.00000000
Any conversion ends with an error. tried a lot of ways. Has anyone experienced something similar?
I try this
PARSE_DATETIME('%m/%d/%Y',date) PARSE_DATE('%m/%d/%Y',date) PARSE_TIMESTAMP("%Y-%m-%d%H:%M:%S%Ez"
and many more tries...
Failed to parse input string "2023-02-13 00:00:00.000000000"
how to convert it correctly?
is it possible to take out the first part of the date and convert it?
I try this
PARSE_DATETIME('%m/%d/%Y',date) PARSE_DATE('%m/%d/%Y',date) PARSE_TIMESTAMP("%Y-%m-%d%H:%M:%S%Ez"
and many more tries...
Failed to parse input string "2023-02-13 00:00:00.000000000"

Related

Python 3.10 datetime strptime not picking up time zone?

I have a timestamp embedded in some JSON data as a string, for ease of inspection and modification. An example looks like this:
"debug_time": 1670238819.9747384,
"last_saved": "2022-12-05 11:13:39.974725 UTC",
When loaded back in, I need to convert it back to a float for comparison against time.time() and similar things, however, I can't seem to find the magic incantations to have it restore the correct value.
In restoring the JSON data, I attempt to convert the string to a float via strptime() like this:
loaded_time = datetime.datetime.strptime(obj.last_saved, '%Y-%m-%d %H:%M:%S.%f %Z')
This does restore the timestamp to a valid datetime object, however calling .tzname() results in None, and my attempts to use loaded_time.replace(tzinfo=zoneinfo.ZoneInfo('UTC')) have not yielded any useful results.
In short, emitting loaded_time.timestamp() yields 1670267619.974725, which is 8 hours ahead of what it should be. I've tried using .astimezone(), in various permutations, but can't find a way to correctly have it convert to the client's local time.
I even tried to hard-code in my own time zone US/Pacific but it stubbornly refuses to give me that original debug_time value back.
This doesn't seem like it should be a difficult problem, but clearly I'm misunderstanding something about how python 3's time handling works. Any ideas are welcome!
Thank you for your time!
you have to use built in function replace like
.strftime("%Y-%m-%dT%H:%M:%S.%f%Z").replace("UTC", "")

Is there a way to convert a string to hexadecimal in haxe?

I am trying to write a program in Haxe but I got stuck on trying to convert a string to hex. I found a solution but I couldn't get it working. Can anyone help?
To convert a string in hexadecimal format into an integer:
final hex = Std.parseInt("0x00");
https://api.haxe.org/Std.html#parseInt

How to fix "StringConverter cannot convert from System.Double." in In\\UiPath

When I make the "Read Cell" in "Excel application scope", I tried to output the read data from Excel by using "Write Line". However, It's not working and it ouput the error as in the Title. Could you someone make it up?
I had the same issue. I'm using the LookupDataTable activity. In my Excel file I have a mix of Strings and Integers. But somehow I also got the error:
NotSupportedException: StringConverter cannot convert from
System.Double.
I solved it by changing the variable from String to GenericValue.
I also tried to give it the Double type, but it didn't work because I think I have different types in the column.
Try this maybe be it will help you to check out
Convert.todouble

How to parse an ISO string value to a NodaTime Instant?

I am getting to know NodaTime and like it a lot. But I don't know it that well (yet)!
Given a value such as '2014-04-08T09:30:18Z', what are the steps required to parse such a string to a NodaTime Instant?
Thank you!
I figured this out. For others who want to do the same thing, here is what I used:
var isoString = "2014-04-08T09:30:18Z";
var result = InstantPattern.GeneralPattern.Parse(isoString).Value;
The Value property in this case returns the actual Instant object. If you omit that, the result is of type ParseResult<Instant> in this case, and has other information such as whether the parsing succeeded, etc.
http://nodatime.org/1.2.x/api/html/T_NodaTime_Text_ParseResult_1.htm
There aren't a lot of examples on Noda Time yet, but I am really liking it and turning to it more and more. Fantastic work by the team who created it. Thank you!

parsing a string that ends

I have a huge string. I need to extract a substring from that that huge string. The conditions are the string starts with either "TECHNICAL" or "JUSTIFY" or "ALIGN" and ends with a number( any number from 1 to 10) followed by period and then followed by space. so for example, I have
string x = "This is a test, again I am testing TECHNICAL: I need to extract this substring starting with testing. 8. This is test again and again and again and again.";
so I need this
TECHNICAL: I need to extract this substring starting with testing.
I was wondering if someone has elegant solution for that.
I was trying to use the regular expression, but I guess I could not figure out the right expresion.
any help will be appreciated.
Thanks in advance.
Try this: #"((?:TECHNICAL|JUSTIFY|ALIGN).*?)(?:[1-9]|10)\. "

Resources