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
How we can work with this?
Assuming I want to get the seconds, I will use this
Hope it helps...
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<?php print_r(getdate(time())); ?>
Which is an array....<?php Array ( [seconds] => 43 [minutes] => 0 [hours] => 1 [mday] => 10 [wday] => 0 [mon] => 11 [year] => 2013 [yday] => 313 [weekday] => Sunday [month] => November [0] => 1384041643 ) ?>
How we can work with this?
Assuming I want to get the seconds, I will use this
You can go on and add more!<?php $time = getdate(time()); echo $time['seconds']; //As listed here Array ( [seconds] => 43 [minutes] => 0 [hours] => 1 [mday] => 10 [wday] => 0 [mon] => 11 [year] => 2013 [yday] => 313 [weekday] => Sunday [month] => November [0] => 1384041643 ) ?>
Hope it helps...
No comments:
Post a Comment