I never used Perl before, so I need a little help formating a date.
What I'm doing is querying a postgres database and then creating a .xml file for a RSS feed. I don't know how to correctly format the timestamp for my .xml file.
Let say I query the database and then store the values in variables. I then print the variables to an .xml file. Here is an example:
my $sth = $conn->prepare("SELEC T date,title,summ ary From news");
$sth->execute() or die "execute failed: " . $sth->errstr();
my($date, $title,$sum);
while (($date,$title, $sum) = $sth->fetchrow()) {
print XML " <lastBuildDate> $date</lastBuildDate>\ n";
}
How do I create the correct format that I need when I print $date?
The format of the timestamp in $date that I get from the database is:
2007-07-02 11:30:01.71055
I need to reformat it to look like:
Tue, 19 Dec 2006 20:15:00 MST
Could someone show me how to do this? I've search on-line for a few hours with no luck.
What I'm doing is querying a postgres database and then creating a .xml file for a RSS feed. I don't know how to correctly format the timestamp for my .xml file.
Let say I query the database and then store the values in variables. I then print the variables to an .xml file. Here is an example:
my $sth = $conn->prepare("SELEC T date,title,summ ary From news");
$sth->execute() or die "execute failed: " . $sth->errstr();
my($date, $title,$sum);
while (($date,$title, $sum) = $sth->fetchrow()) {
print XML " <lastBuildDate> $date</lastBuildDate>\ n";
}
How do I create the correct format that I need when I print $date?
The format of the timestamp in $date that I get from the database is:
2007-07-02 11:30:01.71055
I need to reformat it to look like:
Tue, 19 Dec 2006 20:15:00 MST
Could someone show me how to do this? I've search on-line for a few hours with no luck.
Comment