English 中文(简体)
os 商业产品
原标题:oscommerce products new date formatting for rss

Okay这样重新加工产品。 电子商务中作为载人页输出的网址,问题在于日期的编排方式是错误的,目前的产出就是如此。

Wednesday, 02. October 2002 Using:

tep_date_long($products_new[ products_date_added ])

it needs to be in this format: Wed, 02 Oct 2002 15:00:00 +0200 the php for this is

("D, d M Y H:i:s O", time())

但并不确定如何执行或修改挖掘法

是否有任何想法?

    echo  <?xml version="1.0" encoding="ISO-8859-1"?>
    <rss version="2.0">
    <channel>
    <link>http://www.primedelux.com</link>
    <language>en-uk</language>
    <copyright>Copyright (C) 2011 http://www.primedelux.com</copyright>
    <pubDate>  . date("D, d M Y H:i:s O", time()) .  </pubDate> ;
    ?>
    <?php
      $products_new_array = array();

     $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status =  1  and p.products_id = pd.products_id and pd.language_id =  " . (int)$languages_id . "  order by p.products_date_added DESC, pd.products_name";

      $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); ?>

    <?php
      if ($products_new_split->number_of_rows > 0) {
        $products_new_query = tep_db_query($products_new_split->sql_query);
        while ($products_new = tep_db_fetch_array($products_new_query)) {
          if ($new_price = tep_get_products_special_price($products_new[ products_id ])) {
            $products_price =  <s>  . $currencies->display_price($products_new[ products_price ], tep_get_tax_rate($products_new[ products_tax_class_id ])) .  </s> <span class="productSpecialPrice">  . $currencies->display_price($new_price, tep_get_tax_rate($products_new[ products_tax_class_id ])) .  </span> ;
          iii else {
            $products_price = $currencies->display_price($products_new[ products_price ], tep_get_tax_rate($products_new[ products_tax_class_id ]));
          iii
    ?>
    <?php
    echo  <item> ;
    echo  <title>  . $products_new[ products_name ] .  </title> ;
    echo  <description><![CDATA[  . tep_image( http://www.primedelux.com/images/  . $products_new[ products_image ]) .   ]]>  . $products_new[ products_name ] .  </description> ;


    echo  <link>  . tep_href_link(FILENAME_PRODUCT_INFO,  products_id=  . $products_new[ products_id ]) .  </link> ;
    echo  <guid>  . tep_href_link(FILENAME_PRODUCT_INFO,  products_id=  . $products_new[ products_id ]) .  </guid> ;
    echo  <pubDate>  . tep_date_long($products_new[ products_date_added ]) .  </pubDate> ;
    echo  </item> ;
    ?>
    <?php
        iii
      iii 
    ?>
    <?php echo  </urlset> ;?>
    <?php echo  </channel> ;?>
    <?php echo  </rss> ;?>

电话号码:

// Output a raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
function tep_date_long($raw_date) {
if ( ($raw_date ==  0000-00-00 00:00:00 ) || ($raw_date ==   ) ) return false;

$year = (int)substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);

return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$month,$day,$year));

iii

问题回答

替换:

return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$month,$day,$year));

$time= mktime($hour,$minute,$second,$month,$day,$year);
$x= strftime("%a, %d %b %Y %H:%M:%S",$time);
if($x){
    return $x;
}else{
    return date("D, d M Y H:i:s O", $time);
}

rel=“nofollow”>strftime 所提供的解决办法并不是要简化,而是在手册中找到适当的环境信息。





相关问题
Mysql compaire two dates from datetime?

I was try to measure what is faster and what should be the best way to compare two dates, from datetime record in MySql db. There are several approaches how to grab a date from date time, but I was ...

iPhone Date Picker rolls over to 2010 on December 27th?

So I implemented a UIDatepicker in one of my applications for scheduling and autodialing teleconferences... everything is pretty much ready to go except, while testing I noticed that when the date ...

Convert date Python

I have MMDDYY dates, i.e. today is 111609 How do I convert this to 11/16/2009, in Python?

specifying date format when using $form->inputs() in CakePHP

I am wondering if there is a way to specify the date format in the forms created using CakePHP s $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() ...

NSDateFormat, super simple! Where am I screwing up?

Ok, this is really simple, maybe I m a getting a bit burnt out, but seems like it should work, Query XML feed, put out date string, format, display in a cell. The issue is I m a getting a NULL ...

sqlite writing a date into an email

I am exporting a date value from sqlite and placing it into an email. The date appears like this 279498721.322872 I am using Objective C in an Iphone App. Does anyone know how to make this export ...

热门标签