I have the following data frame:

```
id<-c(1,2,3,4)
date<-c(19970807,19970902,19971010,19970715)
df<-data.frame(id,date)

```

in which the type of the values in date column is 'num'. Now I need to convert the values in date column to 'date' type as 'yyyy-mm-dd'. I tried as.date after loading the 'zoo' library but it resulted in some unacceptable outcomes.
Would be thankful if anyone could help me.