In most of the Programming or scripting language such as PHP or JavaScript, i have come across the time function which tends to calculate the time from year 1970. for example in javascript if i use the function getTime() or in PHP the time() it returns an integer value.
In PHP.
the code with <?php echo time(); ?>
returns an integer value of 1281694425,
what does the value returned by the PHP explains? how and when it is useful?
the same in javascript the getTime() returns the float value since 1970 as it says. by using the below script in JS
<script type="text/javascript">
var d=new Date();
document.write(d.getTime() + " milliseconds since 1970/01/01");
</script>
i want to know when is this type of functions useful to use? and how do we use it?
P.S: is it useful for calculating the time interval? or it is used for storing the current time stamp?
It give you the seconds which passed by since the 1st January 1970. This is useful fore several reasons:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With