|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I am trying to format a string read in like "2/09/2001"
and put a "0" infront of the "2" Has anyone dealt with this before? Is there a function that will pad the from of a string with "0"'s? |
|
#2
|
||||
|
||||
|
Actually is best to pad the date when it's created, but to add a "0" to your date, try something like this:
$currdate = "2/09/2001"; # 9 characters long $date = sprintf("%10d", $currdate); $date =~ tr/ /0/; This will pad the date with a "0" if it's less then 10 characters,(including the "/" slashes). Mickalo
__________________
Thunder Rain Internet Publishing Custom Programming & Database development Providing Personal/Business Internet Solutions that work! |
|
#3
|
|||
|
|||
|
thanks It worked
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Date format of a string |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|