Jump to content

[SOLVED] need this easy code b4 new years...lol


contra10

Recommended Posts

hey its actuallaty the date

 

//This gets today's date 
$date = time () ; 


//This puts the day, month, and year in seperate variables 
$day = date('d', $date) ; 
$month = date('F', $date) ; 
$year = date('Y', $date) ;
$hour = date('g', $date) ;
$minutes = date('i', $date) ;
$meridiem = date('a', $date) ;

 

for some reason when i put the minutes in my sql and echo it out i get on of the digits, not the leading zeros for the minutes lik instead of 9:08 i get 9:8

Link to comment
Share on other sites

If you want to achieve a number like 08 or 00000000843 then to prevent the computer from removing the beginning zeros, you must make the number a string. It is because there is a limit to how many numbers exist and to increase how many numbers exist, the remove the zeros at the beginning unless it is a string where there are infinit combinations. So below is an example of adding each of the above numbers to a variable:

$var1='08';
$var2='00000000843';

As you can see, all I did was place quotes around the numbers turning it into a string. Hope that helps with the confusion.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.