hi all- i am using this script; for getdate in my database-- it works as such but their is a small problem with it....
<input type=hidden name="date" value="<?php echo "$mday/$mon/$year $hours:$minutes"; ?>">
the problem with it is that when it shows the time it shows 21:1 rather than 21:01 or 19:4 instead of 19:04 and so on and so on (you get the picture) (obviously 21:45 shows as 21:45 just time that has 0 in between)
i tried to see if their wa sa different type for minutes than 'minutes' but it is the only one i think......
does anyone know why it would do this???
getdate function not working correctly
Moderator: General Moderators
Use printf(), with %02d for each number:
Code: Select all
<input type=hidden name="date" value="<?php printf('%02d/%02d/%02d %02d:%02d', $mday, $mon, $year, $hours, $minutes); ?>">-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact: