Reading a custom field with a date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amecca
    Mivite

    • Oct 2007
    • 106

    #1

    Reading a custom field with a date

    I am trying to read a custom field with a date in it, like "12/3/2012". I would like to determine if today is before or after that date. Is there a way to do that?
    Alan Mecca
    President
    8:30-5:00 M-Th, 8:30-4:30 F
    T: 800-899-0620
    E: [email protected]
    www.personalizeddoormats.com

  • Kent Multer
    Mega Mivite









    • Mar 2006
    • 3251

    #2
    Re: Reading a custom field with a date

    If you have Toolkit or Toolbelt, you can write a series of tags that will split the date into three separate numbers, so that you can compare them using mvt:if tags. If you tell us a little more about what you're trying to do, there may be other ideas.
    Last edited by Kent Multer; 11-16-12, 09:01 AM.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment

    • amecca
      Mivite

      • Oct 2007
      • 106

      #3
      Re: Reading a custom field with a date

      I have both tookit and toolbelt. Here is what I would like to do. Our products have different Christmas deadline dates. SO for one product the deadline may be 12/12/2012. I can import this date into a custom field. Then I would like to read that field to determine what note I should show on the category or product page. If today's date is after the deadline it would say "This product is past the deadline to be received by Christmas" if before it would say "This product is still available for Christmas delivery".
      Alan Mecca
      President
      8:30-5:00 M-Th, 8:30-4:30 F
      T: 800-899-0620
      E: [email protected]
      www.personalizeddoormats.com

      Comment

      • Kent Multer
        Mega Mivite









        • Mar 2006
        • 3251

        #4
        Re: Reading a custom field with a date

        Displaying messages like that should definitely be do'able, but I can't give you all the code off the top of my head. If you'd like to have me do a little custom editing on your page templates, you can contact me by email to discuss it. Or maybe there's a power user reading this who can give you some code to copy and paste.

        Hope you have a great season :^) --
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment

        • Bruce - PhosphorMedia
          Developer Partner











          • Mar 2006
          • 11256

          #5
          Re: Reading a custom field with a date

          Use Unix time. (http://www.onlineconversion.com/unix_time.htm)

          Then simply use:
          Code:
          <mvt:if expr="s.time_t LT l.settings:product:customfield_values:customfields:ShipTime">
          It can ship
          <mvt:else>
          Sorry, too late
          </mvt:if>
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment

          Working...
          X