0

i am trying to get the day of week from a timestamp:

an example of the timestamp could be:

2014-09-14 18:28:11

I have tried with the following code:

$date = date("D", strtotime($activity[$i]['timestamp']));

However the result i get here is:

Thu

which should have been sunday?

Also is it possible to get it as a full discription instead of a short version of the day name?

Marc Rasmussen
  • 19,771
  • 79
  • 203
  • 364

1 Answers1

2

Answer to part two of the question is that you can just use l (lowercase 'L') and it'll output Sunday instead of Sun.

$date = date("l", strtotime($activity[$i]['timestamp']));

As for the first part, it probably output Thursday, 1 January 1970 because it received an error instead of an actual date as argument to strtotime.

Bird87 ZA
  • 2,313
  • 8
  • 36
  • 69