If you want to do that, you need to use: my $date = sprintf("%s, %d %s %d", $dt->day_abbr, $dt->day, $dt->month_abbr, $dt->year); Note that you need to use sprintf and not printf. But of course, you can also just concatenate the variables using something like: my $date = $dt->day_abbr . ', ' . $dt->day . ' ' . $dt->month_abbr . ' ' . $dt->year); ...but this way is not so nice and with printf or sprintf you can adjust easier the formatting. For example you can choose if you want to print it something like Dec 04 2008 or Dec 4 2008 You can read more about these functions using perldoc -f sprintf and perldoc -f printf Octavian ----- Original Message ----- From: "Lamar Upshaw" <lupshaw@xxxxxxxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Thursday, December 04, 2008 11:39 PM Subject: Re: perl - MySQL - getting the day of the week > Thank you for this. What I'm trying to do is put this in to a variable: > my $date = "Thu, 4 Dec 2008"; > > Some things about perl, I still don't quite understand, and I've learned > everything from the web and this list, so please forgive me for being a bit > slow. *smile* > Can I say: > my $date = > printf("%s, %d %s %d", $dt->day_abbr, $dt->day, > $dt->month_abbr, $dt->year); > > With All Respect, > Upshaw, Lamar T > > > ----- Original Message ----- > From: "Octavian Rasnita" <orasnita@xxxxxxxxx> > To: <programmingblind@xxxxxxxxxxxxx> > Sent: Thursday, December 04, 2008 12:49 PM > Subject: Re: perl - MySQL - getting the day of the week > > >> As you may know, there are very many ways to do this. >> >> One of them is to do: >> >> use DateTime; >> >> my $dt = DateTime->new(year => 2008, month => 12, day => 4); >> >> printf("%s, %d %s %d", $dt->day_abbr, $dt->day, $dt->month_abbr, >> $dt->year); >> >> #It will print: >> Thu, 4 Dec 2008 >> >> Octavian >> >> ----- Original Message ----- >> From: "Lamar Upshaw" <lupshaw@xxxxxxxxxxxxxx> >> To: <programmingblind@xxxxxxxxxxxxx> >> Sent: Thursday, December 04, 2008 9:08 PM >> Subject: perl - MySQL - getting the day of the week >> >> >>> I'm using MySQL to get the current date with perl. I know how I can take >>> a date, and convert it to readable calendar info: >>> 2008-12-04 => Dec, 4 2008 >>> >>> My question is, how do I get perl to: >>> print "Thu, 4 Dec 2008"; >>> >>> It's the day of the week I'm after. >>> >>> With All Respect, >>> Upshaw, Lamar T __________ >>> View the list's information and change your settings at >>> //www.freelists.org/list/programmingblind >>> >> >> __________ >> View the list's information and change your settings at >> //www.freelists.org/list/programmingblind >> > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind