Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old February 9th, 2001, 01:21 PM
dark_jurmanji dark_jurmanji is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Denver, CO
Posts: 0 dark_jurmanji User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 sec
Reputation Power: 0
Send a message via ICQ to dark_jurmanji
Unhappy

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?

Reply With Quote
  #2  
Old February 9th, 2001, 02:21 PM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
Wink

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!

Reply With Quote
  #3  
Old February 9th, 2001, 02:24 PM
dark_jurmanji dark_jurmanji is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Denver, CO
Posts: 0 dark_jurmanji User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 sec
Reputation Power: 0
Send a message via ICQ to dark_jurmanji
Smile

thanks It worked

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Date format of a string


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway