Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 5th Oct 2010, 09:53 PM   #1
HyperActive Warrior
War Room Member
 
Big Squid's Avatar
 
Join Date: 2009
Location: Living between LA & SD
Posts: 205
Thanks: 27
Thanked 36 Times in 33 Posts
Default
Converting UNIX time
Share on: 
fb share twitter share gplus share more share

My brain has melted and is oozing out my ears!

I need help with a code that will convert UNIX timestamps on the fly. That is, I'm writing to php to use with an API. The data will be generated using a FOREACH loop.

Again, I only have access to the data using API.

Here's the code:

Code:
       foreach ($resp['body']['members'] as $members) {
            echo '<p>Members: <br />'.
                'Join Date: '. $members['time'].'<br />'.
                'Name: ' . $members['nick']. '<br />'.
                'Phone #: '. $members['phone']. '</p>';
I'm trying to call the members of a particular subscribership. Included, the join date 'time', the username 'nick', and the phone number 'phone'.

So as this code goes through each array it would automatically convert the unix timestamp (stored in the $members['time']) into a user-friendly time, such as MM-DD-YY.

Any help is greatly appreciated.
Big Squid is offline  
Unread 5th Oct 2010, 10:54 PM   #2
WebNinja
 
jminkler's Avatar
 
Join Date: 2010
Location: Atlanta GA
Posts: 444
Thanks: 19
Thanked 54 Times in 34 Posts
Default
Re: Converting UNIX time
Share on: 
fb share twitter share gplus share more share

Read the manual
http://php.net/manual/en/function.date.php

string date ( string $format [, int $timestamp ] )

in other words ... date('Y-m-d', $members['time']);
jminkler is offline  
The Following User Says Thank You to jminkler For This Useful Post:
Unread 6th Oct 2010, 12:44 AM   #3
HyperActive Warrior
War Room Member
 
Big Squid's Avatar
 
Join Date: 2009
Location: Living between LA & SD
Posts: 205
Thanks: 27
Thanked 36 Times in 33 Posts
Default
Re: Converting UNIX time
Share on: 
fb share twitter share gplus share more share

Got it! Thanks!
Big Squid is offline  
Closed Thread


Bookmarks

Tags
converting, time, unix


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 11:59 AM.