Home | Store | osCommerce Tutorials

PHP strftime() Function

The osCommerce shop always use the PHP strftime() function.

The PHP strftime() function simply formats a local time or date according to locale settings.

The syntax of PHP strftime () is:

strftime (format, timestamp)

The format is a required parameter.

The timestamp is an optional parameter. It specifies the date or time to be formatted. If no timestamp is specified, it uses the current local time.

Here's some of the common format:

  • %a - abbreviated weekday name
  • %A - full weekday name
  • %b - abbreviated month name
  • %B - full month name

PHP strftime() function example:


echo ' The output is: ' . strftime('%B');


The output of the above strftime() function example should look like (depends on current month):

The output is: October

You should see the above strftime() function example in includes/modules/new_products.php of osCommerce shop:

$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

where the print out of the above code is something like "New Products For October".