PHP time() and Mysql now() fucntion

The time () function is a built-in function in PHP . time() returns the current time measured in the number of seconds since the Unix Epoch. The number of seconds can be converted to the current date using date () function in PHP.

<?php
$t=time();
echo($t . "<br>");
echo(date("Y-m-d",$t));
?>

Output

1624962270
2021-06-29

The MySQL NOW() function returns the current date and time in the configured time zone as a string or a number in the 'YYYY-MM-DD HH:MM:DD'  format. The returned type of the NOW() function depends on the context where it is used. For example, in the following statement, the NOW() function returns the current date and time as a string.

select now();

output

PHP time() and Mysql now() fucntion













No comments:

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...