Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Modifications 1

Status
Not open for further replies.

V00D00

Technical User
Jul 11, 2005
78
0
0
US
I am creating a script that will be making calls to an Informix database. Part of the Query is based on date ranges. Using gmtime and time I have gotten the dates formated to M/D/YYYY.

The problem is getting leading zeros in front of the Month and Day when they are only one digit. The final outcome of the date format should be:

01/01/2006

instead of:

1/1/2006

Any insight would be greatly appreciated.
 
Try this.

Code:
$date = sprintf("%02d/%02d/%04d",(split('/',$date)));
 
Thank you very much. That seems to have done the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top