how can I replicate this on vue - vue.js

I'm trying to replicate this on Vue, the date is coming from an array
I have something like this
<h1>{{ mydate | formatDate }}</h1

Related

Setting dbt date variable

I am trying to set a date variable within a dbt model to be the date 7 days ago. The model will run against a Redshift database. I have done the following to set the variable, however I get the error DATE_ADD is not defined:
{%- set start_date = TRUNC(DATE_ADD(day, -7, CURRENT_DATE)) -%}
What is the correct way to set the variable.
jinja is a templating language. When you run dbt, it first executes the jinja to "compile" your model, and then it executes your compiled code against your database.
jinja doesn't have functions called trunc or date_add or current_date, since those are SQL functions.
You have two choices:
Set the variable equal to a string and include that string in your model code, so that the database calculates this date. That would look like this (note the extra quotes):
{%- set start_date = "TRUNC(DATE_ADD(day, -7, CURRENT_DATE))" -%}
select {{ start_date }}
If you compile this and check the code generated in your target directory, you'll see it becomes this SQL:
select TRUNC(DATE_ADD(day, -7, CURRENT_DATE))
Use jinja's context to calculate the date and include the date literal in your SQL. dbt's jinja context includes a special variable called run_started_at, and also Python's datetime module. Putting those together looks like this:
{%- set start_datetime = run_started_at - modules.datetime.timedelta(days=7) -%}
{%- set start_date = start_datetime.strftime("%Y-%m-%d") -%}
select '{{ start_date }}'
This will compile to:
select '2023-01-12'

date input field is taking more than 4 character in vue js input type date

I am using Vuejs 3 and when I use input type date it is taking up to 6 characters in the year field. Is there any way to make it take only 4 characters YYYY in the year field?
You can use max attribute for that. e.g.
<input type="date" max="9999-12-31">

How to get Sysdate in qweb/odoo 11?

How to reference Sysdate in qweb in odoo 11?
I need to compare a date with "sysdate" in qweb, but I'm not able to get the current date.
This way you can get date and time
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"/>
If you want only date
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/>
like this you can get the today's date.
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d/%m/%Y')"/>

In Vue, how do I bind a date object to a date input ? (v-model doesn't work)

// This doesn't work
<input type='date' v-model='store.myDateObject'>
How can I bind a date input to a date object in my store?
Assuming you want your dates as midnight UTC date objects, do this...
<input type='date'
:value='store.myDate.toJSON().substring(0,10)'
#input='store.myDate = new Date($event.target.value)'
>

How to change date format in Netezza?

I have one datetime field(startdatetime) store in Netezza DB as varchar because SSIS is truncating milisec and I want datetime till milisec.
So now I have startdatetime value is like 2014-1-2 11:23:31.921000000
and I want it 2014-01-02 11:23:31.921 Length should be 23. How can I do that?
So what I am doing is I want to do incremental load so i am getting max(startdatetime) from the table and compare it to startdatetime (datetime data type) field coming from source so when startdatetime > max(startdatetime), load that new data. So for that purpose I need to convert it to like 2014-01-02 11:23:31.921
Thanks for the help.
I think what you're asking for is the to_char function, specifically to_char(startdatetime, 'YYYY-MM-DD HH-MI-SS.US'). See IBM's documentation.
If that still leaves too many '0' characters on the end, try using the regex functions to replace it.
regexp_replace(to_char(startdatetime, 'YYYY-MM-DD HH-MI-SS.US'), '0+$', '')