locked
Entry dates are wrong on search page RRS feed

  • Question

  • User1988740161 posted

    Hi, The entry dates on my search page are looking pretty strange.  Does anyone know how I can fix this.  The people who use the website use the post date in negotiations sometimes, so it's important to use real dates.  Below is some content from the page showing the weird date format.  Any suggestions would be appreciated.  Thanks, Bev 

     

     

    23/48/09 1981 PIPER CHEYENNE III $0.00 Piper 1 0 Edit
    <INPUT id=ctl00_Main_AdsGrid_ctl03_AdCheckBox type=checkbox CHECKED name=ctl00$Main$AdsGrid$ctl03$AdCheckBox> 18/45/09 Citation XLS+ Serial # TBD $0.00 Cessna 2 0 Edit
    <INPUT id=ctl00_Main_AdsGrid_ctl04_AdCheckBox type=checkbox CHECKED name=ctl00$Main$AdsGrid$ctl04$AdCheckBox> 18/31/09 Gulfstream G400 Serial # 1513 $0.00 Astra/Gulfstream 3 0 Edit
    <INPUT id=ctl00_Main_AdsGrid_ctl05_AdCheckBox type=checkbox CHECKED name=ctl00$Main$AdsGrid$ctl05$AdCheckBox> 18/17/09 Challenger 300 Serial # 20144 $0.00 Bobardier/Challenger 3 0 Edit
    <INPUT id=ctl00_Main_AdsGrid_ctl06_AdCheckBox type=checkbox CHECKED name=ctl00$Main$AdsGrid$ctl06$AdCheckBox> 18/06/09 Falcon 2000 Serial # 152 $0.00 Dassault 2 0 Edit
    <INPUT id=ctl00_Main_AdsGrid_ctl07_AdCheckBox type=checkbox CHECKED name=ctl00$Main$AdsGrid$ctl07$AdCheckBox> Icon indicating that there are photos for this ad. 18/02/09 Falcon 2000 Serial # 0173 $0.00 Dassault 1 0 Edit
    <INPUT id=ctl00_Main_AdsGrid_ctl08_AdCheckBox type=checkbox CHECKED name=ctl00$Main$AdsGrid$ctl08$AdCheckBox> Icon indicating that there are photos for this ad. 18/55/09 Falcon 50EX Serial # 314 $0.00 Dassault 3 0 Edit

    Sunday, March 1, 2009 2:33 AM

Answers

  • User-2090449847 posted

     To clarify:

    The root of the problem is that the format string was incorrectly using small m's for the month instead of capital M's.  So, the minutes value was being displayed instead of the month.

    The real question that I'd like answered, however, is why was it working before now?  And what changed to uncover this flaw in the code?

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 2, 2009 8:21 PM

All replies

  • User730446648 posted

    Is that column one you added?
    If not what's the name of it?

    When you look at that column directly in the database what does it say?

    It might be your host server.

    Try making a label with id="label1"
    Then on your page load write;

    label1.Text = DateTime.Now

    As soon as you view in browser it should give you the server set date and time.

    Sunday, March 1, 2009 10:33 AM
  • User1452403003 posted

    I have the same problem, but mine only shows up when I try to edit the ad as site admin. It displays the real date if your just looking at the ad. So I've put it on the back burner for now. Please post the fix if you find the answer.

    Monday, March 2, 2009 12:24 PM
  • User-2090449847 posted

    This looks like a case of the Y2K9 bug, like what hit the Microsoft Zune.  I'm looking into how to fix it...

    Monday, March 2, 2009 3:22 PM
  • User-2090449847 posted

    This is a date-formatting issue, somehow related to the Y2K9 bug (not sure how).  Simply do a find and replace to fix:

    Find

    DataFormatString="{0:dd/mm/yy}"

    Replace with

    DataFormatString="{0:MM/dd/yy}"

    Monday, March 2, 2009 4:47 PM
  • User-2090449847 posted

     To clarify:

    The root of the problem is that the format string was incorrectly using small m's for the month instead of capital M's.  So, the minutes value was being displayed instead of the month.

    The real question that I'd like answered, however, is why was it working before now?  And what changed to uncover this flaw in the code?

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 2, 2009 8:21 PM
  • User1988740161 posted

    Thank you so much.  I was able to find two instances of the problem code and made the fix you suggested.  One was line 118 in Admin/Ads.aspx and the other was line 56 in MyAds.aspx.  I've noticed the weird entry dates from time to time, but frankly, there have been so many other things I needed to fix that I didn't give it too much thought until recently.  I haven't made any changes in this code before, so I think the error came with the starterkit download.  Thanks again  Bev

    Tuesday, March 3, 2009 4:39 PM
  • User-1136540166 posted

    Open Search.aspx

    in Design View (assuming you are using Visual Web Designer) click on the area where items are shown. (You will see row after row of "Databound").    Now, at the top right of this part of the web page you will see  a   >   appear.   Click that > 

    You will be presented with a menu "GridView Tasks".
    Select  "Edit Columns"
    Click "Start Date" (or end date as desired)
    Scroll down to  "Data" and find "DataFormatString"
    Make it say {0:MM/dd/yy}

    Try that.   Now it should work fairly the way you want.   If you understand what you just did, then you are welcome to go back and perhaps you want to leave off the year, so leave off the /yy.   Or try using  mm instead of MM and see how it makes you website look.

    As I remember when I first started using the classifieds starter kit, the dates looked ok in  Search.aspx (browse mode) so I looked at the formatting for the date started column there and then learned from it.

    Saturday, March 14, 2009 12:31 PM