Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Anyway.. Ravinder,
I don't think you should try to convert the UNIXTIME to a DATE format.
Just take time() minus the joindate from the table (in UNIXTIME) and subtract them and divide by the number of days in seconds to get the number of days. No need to convert to DATE format.
Or whatever you like, but your query is broken... try again
PS: There is no field in the user table called "jointime" as in your original query. Please check your table definition. Hint:
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Hey Ravinder.
If I were you, I would do this query:
Take that result subtracted from today in UNIXTIME and divide by the number of seconds in year.
That gives you the number of years a person has been a member.
You don't need that fancy MySQL query with all the date / time functions for such a trivial requirement.
As you are beginner in programming, keep it simple... well, I suggest you keep it simple all your life; it's easier to debug or change when you look at the code in 10 years..... keep it simple. Do not be seduced by fancy queries and logic which look cool.... like many programmers and tech people do.
Keep it simple so that a 10th grader can understand it.
Hey Ravinder,
I already fixed and rearranged your code and it is working now:
jQuery:
This is a great badge you came up with. I really like it. Very useful too. Only 11 more to go for this phase of rapid prototype development!
Thanks for trying on this (you were close!) . ... I look forward to your next badge!
What is the next, great, Ravinder Singh idea for a badge?
Thanks a TON Neo for fixing it. Thanks for appreciation on badge it boosted me up now. Will let you/all know once I get another thought of badge
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Hi Ravinder,
Please keep in mind that this also will work, is easier to read, and it a lot shorter:
At this point, I am thinking that soon we should move to a new phase of rapid prototype development if we cannot easily think of new badges. No need to waste time on the final 20% when when are 80% there, more-or-less.
So, if we do not have any ideas for additional badges now, we can just leave the as-is (reserved) and move on.
Or maybe you have some more badge ideas?
So far, it is only you and me with badge ideas, so no need to wait for other UG members to come up with badge logic
I have moved the bug badge out of reserve and into the main stream. Basically, I will assign a color level like the others, based on who has made a good actionable bug report for UNIX.COM. "Good" means screenshots, links, and even details from web dev tools our the HTML source code. So far,... (0 Replies)
Dear All,
Here is the current status of the badging system:
The Beta 1 phase of the new badging system is close to completion.
42 prototype badges have been "allocated"
6 prototype badge slots are held in reserve
The "alert you have new badges" prototype is running and is currently... (4 Replies)
Today I mapped out the new badging system using FA icons, Beta 1 in no particular order except a 6 x 8 grid:
https://www.unix.com/members/1-albums215-picture991.png
The prototype HTML code for this layout:
<style>
.fa-badge-grid {
font-size: 1.5em;
}
.row {
... (38 Replies)