I presume you're asking what the difference is when they both mean day.
日 is considered more formal and used in writing.
天 is considered less formal and used in speech.
Ie. you would write 有一日，我___, but you would say 有一天，我___
October 10, 2019
It depends on different situation.
For descirbe date, what's the day today? we use 日rì，今天是10月11日(Jīn tiān shì 10 yuè 11 rì)，we don't say 今天是10月11天。
if you want to say several days, such as, I traveled in China for 7 days, we'll say 我去中国旅行了7天(Wǒ qù zhōng guó lǚ xíng le 7 tiān)。
sometimes you can use both, sunch as if you want to say Sunday in Chinese, we can say both: 星期天Xīng qí tiān，星期日 Xīng qí rì
I just wrote an article for Chinese begginers, I share some good resource, hope I would help,feel free to check it out.
October 11, 2019
Still haven’t found your answers?
Write down your questions and let the native speakers help you!