Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners Cgi > Re: Adding a co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 6 Topic 1386 of 1496
Post > Topic >>

Re: Adding a comma to format localtime

by krahnj@[EMAIL PROTECTED] (John W. Krahn) Apr 11, 2007 at 09:35 AM

Gregg O'Donnell wrote:
> 
> I use this line of code:
> my $datetime = join ' ', (split ' ', localtime)[0,2,1,4,3];
> 
> To create this result:
> Mon 9 Apr 2007 09:15:05
> 
> How can I add a comma to this result to get:
> Mon, 9 Apr 2007 09:15:05

( my $datetime = localtime ) =~ s{(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)}
                                 {$1, $3 $2 $5 $4};



John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall
 




 6 Posts in Topic:
Adding a comma to format localtime
gpod363@[EMAIL PROTECTED]  2007-04-09 09:41:57 
Re: Adding a comma to format localtime
wiggins@[EMAIL PROTECTED]  2007-04-09 11:11:52 
Re: Adding a comma to format localtime
krahnj@[EMAIL PROTECTED]   2007-04-11 09:35:52 
Re: Adding a comma to format localtime
susheelm@[EMAIL PROTECTED  2007-04-12 11:57:39 
Re: Adding a comma to format localtime
tigger@[EMAIL PROTECTED]   2007-04-12 05:56:14 
Re: Adding a comma to format localtime
Peter@[EMAIL PROTECTED]   2007-04-12 06:54:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 10:22:10 CST 2008.