Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Open Source > Perl
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Perl section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 11th, 2007, 03:44 PM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default want to convert date from 01/12/07 to 12-Jan-2007

Hi Charlie,

your last post was very helpful. Even along with that, i am looking to change the date format from 01/12/07 to 12-Jan-2007, can you please tell me how can i do that and by using which module.

Thanks,
Hur


 
Old April 12th, 2007, 05:47 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

does this help? i would suggest using Date::Calc;

Code:
#!/usr/bin/perl

# Craig R Morton
# 11-Apr-2007

use strict;
use Date::Calc qw/Add_Delta_Days/;

my $current_year = (localtime)[5]+1900;

my $ordinal = 60;
my ($yr, $mon, $mdy) = Add_Delta_Days($curr_year, 1, 1, $ordinal-1);

my $mon_t = (qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/)[$mon-1];

print "$mday $mon_t $yr\n";
www.crmpicco.co.uk
www.ie7.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i convert date into format '2007-10-25T11: vishnu108mishra C# 2 November 23rd, 2007 04:45 AM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM
Chapter 12... rrlevron BOOK: Beginning ASP 3.0 2 January 16th, 2006 01:09 AM
12/30/1899 ASP Date from SQL chris42480 Classic ASP Databases 2 March 8th, 2004 02:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.