-6

I am using below line of code

$time = $_SERVER['REQUEST_TIME'];

but in my database it shows like following format. (unixtimestamp)

1419957753

How i can change it?

Hamza Zafeer
  • 2,360
  • 13
  • 30
  • 42
Nicole
  • 15
  • 5
  • Really? Have you ever tried to search about date() function in PHP? – bcesars Dec 30 '14 at 16:48
  • At least tell me what should i do – Nicole Dec 30 '14 at 16:48
  • 2
    That's a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time). [This question](http://stackoverflow.com/q/10040291/1883647) seems to be duplicated by this. – ajp15243 Dec 30 '14 at 16:48
  • 3
    All of the things I'd like to say right now would have my comment removed, but suffice it to say that perhaps you should consult with the PHP documentation or perhaps there is a service with a name that rhymes with Schmoogle that will allow you to search the internet for useful resources. – Brian Driscoll Dec 30 '14 at 16:49
  • Check the [`date()`](http://php.net/manual/en/function.date.php) function and the rest of PHP support for [date & time](http://php.net/manual/en/book.datetime.php). – axiac Dec 30 '14 at 16:49
  • You can use date() for time as well. See this link: http://php.net/manual/en/function.date.php – bcesars Dec 30 '14 at 16:49
  • 1
    Wow guys, take it easy on the newbie! – sparkyspider Dec 30 '14 at 16:53
  • @Spider at least someone understands that everyone was once a beginner just because i'm a girl doesnt mean i cannot code or learn how to – Nicole Dec 30 '14 at 16:57
  • @Nicole, the guys here are really sticky with questions needing to be very specific, clear and well explained, and it also helps to show that you may have tried to look up something. For example, mentioning that you found a date() function but not a time() function will have shown effort from your side. This being said, they are still being really harsh with you. You can by the way, edit your question, and some of the downvoters may come back and upvote. You can also delete your question to get your 6 points back, but I think your question is valid and they're being a bit mean! – sparkyspider Dec 30 '14 at 20:28

1 Answers1

3

I would use date() instead, which is something I've just done on my website:

<?php echo date("D M d, Y G:i a"); ?>

it's explained in a little more detail here, as regards formatting. Maybe you want:

<?php echo date("G:i"); ?>

the formatting is up to you, but date() is what you want ;-)

luke_mclachlan
  • 1,035
  • 1
  • 15
  • 35