contra10 Posted January 1, 2009 Share Posted January 1, 2009 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 Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted January 1, 2009 Share Posted January 1, 2009 is it int(3) in the database? int(2) would produce 9:8 if you want 9:08 it needs to be int(3) Quote Link to comment Share on other sites More sharing options...
DarkWater Posted January 1, 2009 Share Posted January 1, 2009 Just use a DATETIME column. Quote Link to comment Share on other sites More sharing options...
chronister Posted January 1, 2009 Share Posted January 1, 2009 Do you truly need them in separate variables? If it is not absolutely needed, then make your life easier and create the date/time string with 1 date() call. Quote Link to comment Share on other sites More sharing options...
cwarn23 Posted January 1, 2009 Share Posted January 1, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.