0 votes
in Education by (1.7m points)
I am trying to format of years and months in a manner like yy-mm

I can calculate like this to get my year value:

ROUND(months_between(sysdate,hiringdate)/12)

And this to get the months value:

ROUND(months_between(sysdate,hiringdate))

I just dont know how to combine those 2 to get them in the yy-mm format

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.7m points)
This looks like Oracle, so try this:

select (lpad(floor(months_between(sysdate, hiringdate)/12), 2, '0') || '-' ||

        lpad(mod(floor(months_between(sysdate, hiringdate)), 12), 2, '0')

       ) as yymm

Related questions

0 votes
1 answer
asked May 13 in Education by JackTerrance (1.7m points)
0 votes
1 answer
asked May 8 in Education by JackTerrance (1.7m points)
0 votes
1 answer
asked May 7 in Education by JackTerrance (1.7m points)
0 votes
1 answer
...