James John – Software Engineer

Extracting Date and Time from time() function in PHP

Extracting Date and Time from time() function in PHP

Sometime ago the time() function in PHP seems to confuse me of not knowing how to use it but I was just told it calls up current time and date.

Well, my research later gave me something when I was accessing all functions my Dreamweaver suggests for me. I found the getdate() function and saw example where the time() function was used in it,  I then felt glad because I now know how to use it! :)

You can extract everything about date and time from the time function using the getdate() function.

Run this

The output should be something like this

Which is an array….

How we can work with this?
Assuming I want to get the seconds, I will use this

You can go on and add more!  :D

Hope it helps…

James John

Software Engineer