Jump to content

erm date() <- its not 1969?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
zeroradius

zeroradius

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,406 posts
Ok so i am using the date function like so

date("F j, Y", $news[4]);

news[4] contains the following (yes i checked output with ought date and it is this)

Quote

2010-03-17 00:29:07

the output from the code thou is this

Quote

December 31, 1969

I don't understand why it is doing this. any help would be apreciated.

Edit:

I just tried the same with the time and it is returning 6:33 PM instead of the 12:29 AM that it should be

the code for the time is
$myTime = date("g:i A",$time);

Edited by zeroradius, 04 April 2010 - 01:05 AM.

Posted Image

#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Mate it wont work because this $news[4] have to be a timestamp. Then it will work :)

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts

zeroradius said:

Ok so i am using the date function like so

date("F j, Y", $news[4]);

news[4] contains the following (yes i checked output with ought date and it is this)


the output from the code thou is this


I don't understand why it is doing this. any help would be apreciated.

Edit:

I just tried the same with the time and it is returning 6:33 PM instead of the 12:29 AM that it should be

the code for the time is
$myTime = date("g:i A",$time);

As Jaan said $news[4] needs to be a valid unix timestamp PHP: time - Manual. Also, when you call the time() function, it gets the time of the server which might be configured for a different timezone.

#4
zeroradius

zeroradius

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,406 posts
Ok thanx guys. I used a feature in phpMyAdmin to get the time on my sample fields, I asumed it was the corrrect format. Guess not. Thanks again y'all

Edit: That worked.
Posted Image