TeraData REGEXP_SUBSTR date extraction from API Field - teradata

Community! I am trying to get this syntax to work and I need some assistance. I need to remove everything in the API field and just get the date in the column. I am struggling to accomplish this and not sure how to write this. Any rewrites would be appreciated. Thanks Lads!
[EXTENDED_DATA] API Field:
{"redeterminationDate":"2023-01-01 12:00:00"}
Output Needed as date:
2023-01-01
,REGEXP_SUBSTR(EXTENDED_DATA,'[^.-,]+[^0-9]+[^.-,]+[^0-9]+[^.-,]+[^0-9]'1,9) AS DATE

If that's the consistent structure, you can just substring it out. We can use instr to find the second colon and add 2 to get our starting position:
substr(<column>,instr(<column>,':',1,2)+2,10)

Related

Drupal JSONAPI date range date range

I followed the documentation on filtering.
Used the following code in order to fetch date range data.
&filter[datefilter][condition][path]=field_date&filter[datefilter][condition][operator]=>=&filter[datefilter][condition][value]=${fiscal_year_start}&filter[datefilter][condition][path]=field_date&filter[datefilter][condition][operator]=<=&filter[datefilter][condition][value]=${fiscal_year_end}
It fetches the second filter condition only. It would be great if anyone can help me with this issue.
It was solved once I change the second condition filter name [datefilter] to a different name.

SOLR Date range

I have to make an ezfind search page with date functions. For the SOLR filter I tried to use something like this: attr_publish_date_dt:[NOW-6MONTH TO NOW] but I don't get any result.
If I use it this way attr_publish_date_dt:[* TO NOW], it works. But all queries without an asterisk on the left hand don't work.
attr_publish_date_dt contains a unix timestamp so I also tried to use 2 timestamps from the attr_publish_date_dt:[* TO NOW] result, instead of [NOW-6MONTH TO NOW], but then I get also no results.
Can anyone help me please? Thanks in advance
Frank
Date searches are supported on a date field. You will need to define a field of that type, and submit dates in ISO-8601 format.
http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/schema/DateField.html
If you cannot properly format the timestamp before sending it to Solr, you may be able to use a DateFormatTransformer or a ScriptTransformer to do the job.
http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer
http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer

Control input of SQLite attribute to date format only.

I have been reading all about converting TEXT fields into date formats and ways to use Python to create date objects but my question remains.
My table has a dateTime column that is specified as TEXT, I would like to build a constraint that forces input to be in dateTime format, but as SQLite doesn't do dates (as I would like) I haven't worked out how to do it.
My current ideas: 1. Limit number of characters
2. Set separate attributes for day, month and year and constrain their domains
3. It is silly to do this on the database side just do it in the user interface
I would appreciate your opinions on these or other options.
Thanks :)
I've been trying to solve the same issue and the method I came up with was to use the date/time functions to parse the value and check that it hasn't changed. Essentially the following:
CREATE TABLE dts_test (
dts TEXT CHECK (dts IS datetime(dts))
);
If the default format is not what you want you can use the strftime or similar to design whatever format you want, but it must be something that the built-in date and time functions can parse.

simple question on asp net profile

i believe this is a simple question but i can't figure out myself. In the aspnet profile there is propertynames column with value [value]::: (e.g. OfficeKey:S:0:1:)
Does anyone know what the ":S:0:1:" is? How can I read it?
thanks
It means it's a String, which starts at position 0 in the PropertyValuesString field, and is 1 character long.
Have a read of http://pretzelsteelersfan.blogspot.com/2007/03/get-aspnet-profile-properties-from-sql.html if you want to do your own manipulation of the fields in SQL.

WordPress custom content type date field

Hey, I'm trying to build the most intuitive possible Event post type. I'm wondering if there's a core method to both print out and capture the contents of a date field - specifically year/month/day, I don't need hours/minutes. I also need to be able to sort entries by date to print out later - for instance, I need all of the events from January. Something that can save me formatting the fields, and then parsing and saving them manually.
Any ideas are welcomed! Thanks in advance for your time.
There was no rock solid WP core solution to this, but the system I created is composed of:
SQL CONCAT to compare a date field to CURDATE, etc.
PHP strToTime to get the date back from the database
Generally speaking, if you save your date to the DB in UNIX time format it's easy to work with in SQL queries and in your PHP output.

Resources