In most programming languages ββor scripts, such as PHP or JavaScript, I came across a time function that tends to calculate time since 1970. For example, in javascript, if I use the getTime () or PHP function, time () returns an integer value.
In PHP.
code with <?php echo time(); ?>returns the integer value 1281694425, what explains the value returned by php? how and when is it useful?
the same in javascript getTime () has been returning a float value since 1970, as it says. using 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 this type of function is useful to use? and how do we use it?
PS: is it useful for calculating the time interval? or is it used to store the current timestamp?
source
share