Thread: Converting time

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0

    Converting time


    My supervisor siad, I should make my project more user friendly.

    Please, how can i convert : 25-12-2012 9:04 to » : two days ago by 9:04

    And

    Convert :27-12-2012 7:42 »to : just now
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,995
    Rep Power
    9397
    Depends on the rules you want to follow. When does it transition from "one day ago" to "two days ago"? How long does the "just now" period last?

    Either way you'll be looking at dates or timestamps. Protips:
    * Learn about date() time() mktime() and strtotime()
    * You can use date() to get the components of a date by themselves, such as the year or minute
    * Subtracting timestamps, which you can get from time() mktime() and strtotime(), can tell you the number of seconds elapsed
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    7
    Rep Power
    0
    Thanks you so much.
    But, the Time I have to finish the project Is too short for me to start going deeper into those functions .
    Please, If you can give me an example or clue how those functions can manipulate time ..by converting it the way I want it ...I will be very grateful.


    Thanks.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    676
    Rep Power
    7
    I got a couple otions for you. My question is, what do you all want it to say? Only like 4 items? i.e. Just Now, Today, One Day Ago, Two Days Ago? Or what after 2 days? Maybe 1-7 days ago, being a week, then just have it state the time it was posted when beyond that?

IMN logo majestic logo threadwatch logo seochat tools logo