SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    convert timestamp

    Hi guys, I Need to convert this
    PHP Code:
    $time='1202146474'

    to

    dd/mm/yyyy

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    http://www.php.net/manual/en/function.date.php
    It will go into the second argument.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Member AirTraffic's Avatar
    Join Date
    Sep 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $date=date("Y-m-d H:i:s""$time); 
    this returns todays date?

    I need the date in the variable

  5. #5
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $time 1202146474;
    $date date('d/m/Y'$time);
    echo 
    $date
    Last edited by Raju Gautam; Feb 4, 2008 at 11:27.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  6. #6
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    You should fix your errors then it will work.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  7. #7
    SitePoint Evangelist dev_cw's Avatar
    Join Date
    Dec 2005
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have always used strftime(). Why is date() recommended here over strftime()? Is one better to use? Just currious

    Code:
    $time = 1202146474;
    $date = strftime('%d/%m/%Y', $time);
    echo $date;
    "You can just hang outside in the sun all day tossing a ball around...
    Or you can sit at your computer and do something that matters."
    - Cartman

  8. #8
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    If you use a language other then English then one would use strftime as its locale aware.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



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
  •