new_df.withColumn('SVCDATE2',
(new_df.next_diag_date-new_df.SVCDATE).days).show()

+-----------+----------+--------------+ | PATID| SVCDATE|next_diag_date|
+-----------+----------+--------------+ |12345655545|2012-02-13|
2012-02-13| |12345655545|2012-02-13| 2012-02-13| |12345655545|2012-02-13|
2012-02-27| +-----------+----------+--------------+

Reply via email to