Hello, I am kunaal a fullstack developer.I have a youtube channel "Modern Web" where I teach to make awesome web UI/ UX. Don't forget to checkout my youtube channel
Well, I am doing this to give a unique name to uploaded image for example if, user uploads an image "img.png" then the uploaded image on server side will have current date and time to make that image specific. Than the uploaded image maybe look like this. "1657381749img.png"
Hello, I am kunaal a fullstack developer.I have a youtube channel "Modern Web" where I teach to make awesome web UI/ UX. Don't forget to checkout my youtube channel
Hello, I am kunaal a fullstack developer.I have a youtube channel "Modern Web" where I teach to make awesome web UI/ UX. Don't forget to checkout my youtube channel
Why are you doing
date.getDate() + date.getTime() + file.name;
github.com/kunaal438/blogging-site...
Well, I am doing this to give a unique name to uploaded image for example if, user uploads an image "img.png" then the uploaded image on server side will have current date and time to make that image specific. Than the uploaded image maybe look like this. "1657381749img.png"
getTime() would be sufficient to give unique id, date.getDate() is unnecessary.
Because for any instance of time, both will be same.
I think getDate can give more uniqueness. And if we want to see specific date published images we can also filter it.
getTime() is same as getDate(), getTime() will return unix epoch time in milli seconds.
You can also see date from getTime ().
Advantage of getTime()":
sort by date because getTime () is just a number
sort by date range
smaller image name
etc...
Oh! My bad😅😅, I didn't knew about it. Thanks for telling 😄😄