SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating a timestamp from a european date?

    Hi,
    I have a date, in european format, dd/mm/yyyy. Is there a way for me to convert this to a timestamp?



    thanks

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Fair few ways TBH.
    PHP Code:
    $timestamp strtotime(str_replace('/''-''25/12/2010'));
    echo 
    date('r'$timestamp); #Sat, 25 Dec 2010 00:00:00 +0000 
    PHP Code:
    $timestamp strtotime(vsprintf('%s-%s-%s'explode('/''25/12/2010')));
    echo 
    date('r'$timestamp); #Sat, 25 Dec 2010 00:00:00 +0000 
    PHP Code:
    $timestamp mktime(nullnullnullsubstr('25/12/2010'32), substr('25/12/2010'02), substr('25/12/2010'64));
    echo 
    date('r'$timestamp); #Sat, 25 Dec 2010 00:00:00 +0000 
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that Anthony


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
  •