Code Comments
Programming Forum and web based access to our favorite programming groups.Hi. Does anyone know of a program that can insert a datestamp into a web page that refers to the current w? We have a w
ly online publication, whose front page is generated by PHP includes pulling snippets from various articles during the w
. At the top of the page I manually enter, "Articles for the W
of August 23, 2004" (for instance). Might there be a program that can do this automatically? (I looked at various "Last Updated" scripts but that changes the date each time an article is posted, of course. I would instead like it to remain the date of the w
's start, in our case each Monday.) Thanks.
Post Follow-up to this messageSandy Bremmer wrote: > Hi. Does anyone know of a program that can insert a datestamp into > a web page that refers to the current w? We have a w
ly > online publication, whose front page is generated by PHP includes > pulling snippets from various articles during the w
. At the top > of the page I manually enter, "Articles for the W
of August 23, > 2004" (for instance). > > Might there be a program that can do this automatically? (I looked > at various "Last Updated" scripts but that changes the date each > time an article is posted, of course. I would instead like it to > remain the date of the w
's start, in our case each Monday.) In Perl you can for instance do: our $time = time; my $wday = (localtime $time)[6]; my ($mday,$mon,$year) = (localtime $time - ($wday ? $wday - 1 : 6) * 86400 )[3..5]; my @months = qw/January February March April May June July August September October November December/; printf 'Articles for the W
of %s %d, %d', $months[$mon], $mday, $year+1900; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
Post Follow-up to this messageOn Sun, 22 Aug 2004 10:13:59 +0200, Gunnar Hjalmarsson <noreply@gunnar.cc> wrote: >Sandy Bremmer wrote: > >In Perl you can for instance do: > > our $time = time; > my $wday = (localtime $time)[6]; > my ($mday,$mon,$year) = > (localtime $time - ($wday ? $wday - 1 : 6) * 86400 )[3..5]; > my @months = qw/January February March April May June > July August September October November December/; > printf 'Articles for the Wof %s %d, %d', > $months[$mon], $mday, $year+1900; Wow. Thank you!! Sandy
Post Follow-up to this messageGunnar Hjalmarsson wrote: > In Perl you can for instance do: > > our $time = time; > my $wday = (localtime $time)[6]; > my ($mday,$mon,$year) = > (localtime $time - ($wday ? $wday - 1 : 6) * 86400 )[3..5]; > my @months = qw/January February March April May June > July August September October November December/; > printf 'Articles for the Wof %s %d, %d', > $months[$mon], $mday, $year+1900; Which roughly translates into the following PHP code: <? $time = time(); list (,,,,,,$wday) = localtime($time); list (,,,$mday,$mon,$year) = localtime( $time - ($wday ? $wday - 1 : 6) * 86400 ); $months = explode( " ", "January February March April May June " . "July August September October November " . "December" ); printf( 'Articles for the W
of %s %d, %d', $months[$mon], $mday, $year + 1900 ); ?> JW
Post Follow-up to this messageOn Sun, 22 Aug 2004 15:43:20 +0200, "Janwillem Borleffs" <jw@jwscripts.com> wrote: >Gunnar Hjalmarsson wrote: > >Which roughly translates into the following PHP code: > ><? > >$time = time(); >list (,,,,,,$wday) = localtime($time); > >list (,,,$mday,$mon,$year) = localtime( > $time - ($wday ? $wday - 1 : 6) * 86400 > ); > >$months = explode( > " ", > "January February March April May June " . > "July August September October November " . > "December" > ); > >printf( > 'Articles for the Wof %s %d, %d', > $months[$mon], $mday, $year + 1900 > ); > >?> I know USENET is busy and we shouldn't waste notes space saying thank you (done privately instead), but I'm sorry, I just can't ever accept the amazing generosity of this medium and the people using it and not say thanks publicly. I suppose I'm a hopeless sentimentalist but it never stops to amaze me how I can post a note that goes out to the "world" and then get back (often within the hour) such helpful replies from people I'll probably never know. Okay, ramble over. Thank you for this help, it works beautifully. Sandy
Post Follow-up to this message"Sandy Bremmer" <no_email@no_email_thanx.com> wrote in message news:udahi05ur9udk3fqj90c4mjo3uknunbo7g@ 4ax.com... > > I know USENET is busy and we shouldn't waste notes space saying thank > you (done privately instead), but I'm sorry, I just can't ever accept > the amazing generosity of this medium and the people using it and not > say thanks publicly. don't worry. thanks are acceptable. in fact, a note saying that a solution worked for you is helpful. It tells other that there is no need to find more solutions, and it helps anyone looking for a similar solution later, when they ramble onto the thread. gnari
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.