Is there any way to get the get the specific values from date such as year , month , day .
Actually we have in php date function . If we give date (Y-m ) ; it will give us 2010-07 .
I want like this in postgres(psql) .
Thanks in Advance…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SELECT to_char(CURRENT_DATE, 'MM')FROM v_use_doc_line
;
This will provide you with the month value of the
CURRENT_DATE. If you need year, just replaceMMwithYYYY.I hope you can guess now what you should do to get the day :).
For further information, see the to_char function of postgresql.