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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.