![]() ![]() Select *,round(abs(birthday :: date - fin_date :: date)/365. Get difference between two dates in postgresql by year with an example:ĭifference between two dates in R by year can be calculated by finding difference between two dates and dividing them by 365.25 along with absolute function as shown below Select *,round(abs(birthday :: date - fin_date :: date)/(365.25/12),2) as diff_months from student_detail1 Get difference between two dates in postgresql by months with an example:ĭifference between two dates in postgresql by months can be can be calculated by finding difference between two dates and dividing them by 365.25/12 along with absolute function as shown below ![]() Get difference between two dates in postgresql by weeks with an example:ĭifference between two dates in postgresql by weeks can be calculated by finding difference between two dates and dividing them by 7 along with absolute function as shown below select *,abs(birthday :: date - fin_date :: date)/7 as diff_weeks from student_detail1 Get difference between two dates in postgresql by days with an example:ĭifference between two dates in postgresql can be calculated by finding difference between two dates along with absolute function as shown below select *,abs(birthday :: date - fin_date :: date) as diff_days from student_detail1 Get difference between two dates in Postgresql by years with an example.Get difference between two dates in Postgresql by months with an example.Get difference between two dates in Postgresql by weeks with an example.Get difference between two dates in Postgresql by days with an example.We will be using abs() function along with date difference. Count the number of records per week SELECT the last day of month Event Triggers Export PostgreSQL database table header and data to CSV file EXTENSION dblink and postgresfdw Find String Length / Character Length Inheritance INSERT JSON Support Postgres cryptographic functions Postgres Tip and Tricks PostgreSQL High Availability. In Order to get difference between two dates in postgresql by days, weeks, months and years. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |