Zen Cart Logo
Forums / General Questions / Show todays date

Show todays date

Locked

Views: 1,818

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
11 Jan 2007, 3:06 AM
#1
gonewild avatar

gonewild

Zen Follower

Join Date:
Apr 2005
Posts:
145
Plugin Contributions:
0

Show todays date

I want to have a daily special headed with todays date.

Now the specials box has this line;

define('TABLE_HEADING_SPECIALS_INDEX', 'Daily Special For %s');

It displays as "Daily Special For January"

I want it to be "Daily special for (todays date)"

What do I need to change "%s" to to show todays date?

thanks.

11 Jan 2007, 3:50 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Show todays date

You leave this as is but edit this file & line /includes/modules/specials_index.php Find this Line:

$title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_SPECIALS_INDEX, strftime('%B')) . '</h2>'; 

Assuming you want month/day/year change to:

$title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_SPECIALS_INDEX, strftime(
'%m/%d/%Y')) . '</h2>'; 

This should get you the month day and year...you can leave out what you do not want and/or add others like the hour /min/sec

11 Jan 2007, 4:04 AM
#3
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Show todays date

NEWS FLASH!!! Alternatively:

define('TABLE_HEADING_SPECIALS_INDEX', 'Daily Special For' . date('D M d Y));
11 Jan 2007, 4:30 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Show todays date

CORRECTION:

define('TABLE_HEADING_SPECIALS_INDEX', 'Daily Special For' . date('D M d Y'));

Credit to "Ajeh"

11 Jan 2007, 4:33 AM
#5
gonewild avatar

gonewild

Zen Follower

Join Date:
Apr 2005
Posts:
145
Plugin Contributions:
0

Re: Show todays date

kobra:

You leave this as is but edit this file & line /includes/modules/specials_index.php Find this Line:

$title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_SPECIALS_INDEX, strftime('%B')) . '</h2>';

> Assuming you want month/day/year change to:
> ```
$title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_SPECIALS_INDEX, strftime(
'%m/%d/%Y')) . '</h2>'; 

This should get you the month day and year...you can leave out what you do not want and/or add others like the hour /min/sec

Thanks, that got the date displayed.
It displays the date as 01/10/07.
How can I change it to Jan/10/2007 or better yet January 10, 2007?
I tried changeing %m to %M but that did not work.

11 Jan 2007, 4:54 AM
#6
gonewild avatar

gonewild

Zen Follower

Join Date:
Apr 2005
Posts:
145
Plugin Contributions:
0

Re: Show todays date

OK, the second line worked the best, but both worked.
In case someone else has the same question I used this line in english.php

define('TABLE_HEADING_SPECIALS_INDEX', 'Daily Special for ' . date('F d, Y'));

It displays the date as January 10, 2007.

Thanks Kobra and Ajeh!