Why does Stackdriver logging does not respect the advanced filter condition for timestamp? - google-cloud-logging

I have selected 'No limit' then I wrote a simply filter in Logs Viewer console
timestamp>="2020-01-30T15:00:00Z" AND timestamp<="2020-01-30T16:00:00Z"
There is one log for this condition but it returned nothing in the console. When I changed the filter as follows,
timestamp>="2020-01-30T10:00:00Z" AND timestamp<="2020-01-30T16:00:00Z"
it shows me the result for timestamp>="2020-01-30T15:00:00Z" AND timestamp<="2020-01-30T16:00:00Z".
And timestamp>="2020-01-30T09:00:00Z" AND timestamp<="2020-01-30T16:00:00Z" shows result for timestamp>="2020-01-30T14:00:00Z" AND timestamp<="2020-01-30T16:00:00Z".
What am I doing wrong?

For the base of my answer, I will be using this documentation on advanced logs queries as the document shows you how to write advanced logs queries, which are the expressions that can specify a set of log entries from any number of logs.
To begin, the timestamp field type that you are using permits query value string in RFC 3339 or ISO 8601 format. In your case, you are using the RFC 3339 type.
In query expressions, timestamps in RFC 3339 format can specify a timezone with "Z" or ±hh:mm. Also, timestamps are represented to nanosecond accuracy.
More importantly, when writing a query with a timestamp, you must also select No limit from the time-range selector below the search-query box. Check image below to have a visual.
So overall, there is nothing wrong with your query search:
timestamp>="2020-01-30T15:00:00Z" AND timestamp<="2020-01-30T16:00:00Z"
Just make sure that you have the No limit selected from the time-range selector.
If that still does not work for you, then you can try writing the same query search in a different format, like this:
timestamp >= "2020-01-30T15:00:00Z" timestamp <= "2020-01-30T16:00:00Z"
I hope this helps!

Related

Changing format of date without using to_char - Oracle

I have to get the max payment date on an invoice and I am having trouble with the date format. I do not need the max in this formula as I am using the format in a reporting tool that is pulling the max from what it finds for me.
Using "to_char({datefield},'mm/dd/yyyy')" works for displaying that date the way we would like BUT when you use summary function MAX it does not pull the correct date because it is looking at a string and not a date (it will think 12/3/21 is larger than 3/2/22).
Another thing I have tried is trunc - "trunc({datefield})" which gives us the correct max date but it changes the formatting. For example if the date prior to the formula being applied is "8/12/21 12:00:00:000" the trunc formula will display it as 12-08-21 which is horribly wrong.
Long story short is I need a way to change a date/time to date with the format of 'mmmm/dd/yyyy' WITHOUT converting it to a string with something like to_char. Thank you!!!!
A DATE is a binary data type consisting of 7 bytes representing: century, year-of-century, month, day, hour, minute and second. It ALWAYS has all of those components and it is NEVER stored with any (human-readable) format.
What you are seeing when a date is displayed is the client application you are using to access the database making a decision to be helpful to you, the user, and display the binary DATE provided by the database in a human-readable format.
If you want to change how the DATE is displayed then you either need to:
Change the settings on the client application that controls how it formats dates when it displays them to you; or
Change the data-type so that it is no longer a DATE (which does not have a format) to a data type where the values of the date can be formatted (such as a string). You can do this using TO_CHAR.
If you want to find the maximum then do it BEFORE applying the formatting:
SELECT TO_CHAR(MAX({datefield}),'mm/dd/yyyy')
FROM your_table;

Trying to return the maximum value of a filtered date column in Power BI

I have a table within Power BI that has a date field, and a value field. I am filtering on this date field, using a slicer, to sum all of the value data before the specified date. I would like to get this date value to use in a LOOKUPVALUE() elsewhere (to get a conversion rate).
Is there a way to accomplish this?
I have tried the DAX functions that return the values of a particular table/column with filters preserved but this never seems to work, and just returns the entire dataset, e.g. VALUES(), FILTERS(), ALLEXCEPT().
Any help would be greatly appreciated!
I found a solution using measures.
The DAX for future reference:
Filter Date = CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table'))

How do I query InfluxDB to show me current time and date?

I couldn't find much documentation on this. How do I query InfluxDB to show me current database system time and date?
SHOW DIAGNOSTICS will do it, if you're an admin.
If you're not an admin, you can cheat:
precision rfc3339
INSERT foo,dummy_tag="time_test" testval=0i
SELECT last(*) FROM foo
Which is a bit awkward. This might deserve a feature request on their github page: https://github.com/influxdata/influxdb/issues
Another possibility is to look at the HTTP-header of any response from the influx server. It contains a "Date" field. However, the HTTP-date field only has seconds precision.

Listing messages with more precision than yyyy/mm/dd

I'm trying to get all the messages sent to a user after a certain point in time, by using the Gmail API. I've successfully retrieved messages after a certain date by using the query q=after:2015/01/19 in the API Explorer.
I would like to be more specific than this and specify an hour and a minute of the day. Is this possible? I ask since the Advanced Search-specification only contains the most useful operators.
You can use a search query to list messages after a certain date with second accuracy.
Use the search term after:SOME_TIME_IN_SECONDS_SINCE_EPOCH. Gmail supports the after keyword using a timestamp instead of the yyyy/mm/dd format.

Datetime Format Setting In SSRS

We have a requirement where date time values would be passed to the report parameter which is of "String" date type (and not "DateTime"). The report parameter would be a queried one i.e. it would have a list of values in which the passed value should fall in.
The strange part is that if the date time value passed to this parameter is passed in this format mm/dd/yyyy hh:mm:ss AM/PM then only it succeeds otherwise a error is displayed (If month/date/hour/minute/second is having a single digit value then we need to pass single digit value to parameter as well).
Assuming that the report server picks this format from the "regional settings" in control panel, we tried modifying the date & time formats as yyyy-mm-dd & HH:mm:ss but the outcome was the same.
On researching more I found some suggestions specifying to change the language property in the rdl (I was not able to figure out how) but this would not be the solution I am looking for. I also found another topic here but it didn't provide the solution we are looking for.
I need to understand if this format is controlled at the report server level & is it configurable. It would be great if someone can provide some guidance.
Thanks.
Format(,"mm/dd/yyyy hh:mm:ss AM/PM ")
Then it doesn't matter what the regional settings are.

Resources