Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use time() Function in php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 122
    Comment on it

    What is use of time() Function in php ?

    Php time() function basically use for returns a current unix timestamp. In which, you can utilize the date() function to format it to your desiderata.

    You can see below example of time() function.

    <?php
            $Currenttime=time();
           //$Currenttime is a variable in which store current  date and time
            echo($Currenttime . "<br>");
            //when echo $Currenttime  then echo only date in this 1448270711 format
    
            echo(date("Y-m-d",$Currenttime). "<br>");
            //when echo $Currenttime  in ("Y-m-d") format then date will come 2015-11-23
    
             // If you want print current date and time both then use echo(date("Y-m-d h:i:sa",$Currenttime));
             //look like this:
              echo(date("Y-m-d h:i:sa",$Currenttime));
    
        ?>     
    

    So, finally output will come

    1448271768

    2015-11-23

    2015-11-23 03:12:48pm

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: