Hi Pelumi, It's kind of you to offer code, however there is a similar functionality in contrib.humanize: https://docs.djangoproject.com/en/4.1/ref/contrib/humanize/#naturaltime
Perhaps this does what you require? -- David On Fri, 9 Sept 2022 at 23:50, Bhuvnesh Sharma <bhuvnesh...@gmail.com> wrote: > Hi, > if you are using templates then you can simply write: > > <span class="thread__date">{{message.created|timesince}} ago</span> > > where created is a field of message storing the date and time when the > message was created. > > created = models.DateTimeField(auto_now_add=True) > > > On Friday, September 9, 2022 at 7:11:00 PM UTC+5:30 pmicha...@gmail.com > wrote: > >> Hello. I was developing an instagram clone website but got a problem when >> I wanted to add timing to the post, timing like "2 minutes ago", "just now" >> etc. I searched through the internet I couldn't get the right solution (I >> don't know if there is solution for it yet). Then I decided to go on a >> journey of solving the problem myself, which I did and I will like to share >> the codes with the community for review and improvements (if any). I have >> no idea where to do that, I will love to get a reply soon because I cannot >> wait to contribute to django. I am also ready to give full detail of the >> code and how to use. > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/664a2283-be6d-49db-9316-7940b013297fn%40googlegroups.com > <https://groups.google.com/d/msgid/django-developers/664a2283-be6d-49db-9316-7940b013297fn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CADyZw-7Vq%3DMoJhWVtMsrCD99a%3D_82P4xrT3xqQx6PzF8rqYSMA%40mail.gmail.com.