SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pakistan
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile i have a result like 3.5....

    i have a result like 3.5 i want to seperate this result like 3 and .5...anybody know how to do this?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,169
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    You want to separate them into what, a string with a space, or an array of 2 values?

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pakistan
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    i want two results from this in one result have 3 and the other results have .5................

  4. #4
    SitePoint Evangelist
    Join Date
    Jun 2006
    Location
    Wigan, Lancashire. UK
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by asady View Post
    i have a result like 3.5 i want to seperate this result like 3 and .5...anybody know how to do this?
    With a little bit of basic mathematics
    PHP Code:
    $value 3.5;
    $integerPart floor($value);
    $decimalPart $value floor($value); 
    ---
    Development Projects:
    PHPExcel
    PHPPowerPoint

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pakistan
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Thanx Mark Baker it works correctly....

  6. #6
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pakistan
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    i have two times mean time in and time out i am entering these time manually...and the end i want the result in hours mean total hours between time in and time out....time format is 12 hours mean am and pm...anybody know how to do this?

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,169
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    The date/time functions have so many features they can look a bit daunting at first. But the way I would do it is to use mktime() on the 2 values to get their timestamp values, subtract the older, then use strftime to get it back to hour.minutes


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •