Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2008
    Posts
    102
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Creating a timestamp using informations from a post

    Hi all, I was wondering if anyone could help me creating a php function which will create a timestamp using some posting values here is my code

    seconds will always be 0

    i need something like

    PHP Code:
    function createTimestamp($month$day$year$hour$minute)
    {
          
    // do the cool threatment :)
          
          
    return $coolTimeStamp;

    the day will be of type "j" which means from 1-31 not including 0's.
    month will be of type "n" which means from 1-12 not including 0's.
    year is type "Y" which means 0000 format.
    hours of type "H" not using AM PM Ex: 19h30
    minutes of type "m" using 0's example 09 minutes

    thanks in advance.

    PHP Code:
    <?php
        session_start
    ();
        
        if( isset(
    $_SESSION["dcmsa"]) )
        {
            include(
    "sql.php");
            
            
    $id $_POST["id"];
            
    $title $_POST["title"];
            
    $desc $_POST["desc"];
            
    $month $_POST["month"];
            
    $day $_POST["day"];
            
    $year $_POST["year"];
            
    $hour $_POST["hour"];
            
    $minutes $_POST["minutes"];
            
            if( 
    $id == )
            {
            
            }
            else
            {
                
            }
        }
        
    ?>
    Last edited by dsylebee; 09-08-2009 at 03:36 PM.

  • #2
    Regular Coder
    Join Date
    Jan 2008
    Location
    Geneva, Switzerland
    Posts
    413
    Thanks
    12
    Thanked 29 Times in 29 Posts
    You want to use MKTIME

    Have a look at the mktime function on php.net!
    Chuck Norris counted to infinity.
    Twice.

  • Users who have thanked Arnaud for this post:

    dsylebee (09-08-2009)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •