• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
      • Try XenForo Demo
      • New Posts
      • FAQ
      • Calendar
      • Community
        • Groups
        • Albums
        • Member List
      • Forum Actions
        • Mark Forums Read
      • Quick Links
        • Today's Posts
        • Who's Online
      • Sponsor
        • Sponsor a Feature
        • List of Donors
    • Wiki
    • Support
    • What's New?
    • Buy Now
    • Manual
    • 
    • Forum
    • VaultWiki How-Tos
    • VaultWiki Questions
    • Dates

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Results 1 to 3 of 3

    Thread: Dates

    • Thread Tools
      • Show Printable Version
    1. December 31, 2017 #1
      SurferJon
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • View Articles
      SurferJon is offline
      Junior Member
      Join Date
      November 7, 2015
      Posts
      21
      Rep Power
      129

      Dates

      Is there a way for a template to accept a date variable like "12-31-17" and change it into "Sunday, December 31st, 2017" for the template's output? Like one of those PHP time variables?

      Then, is there a way to get a template to only display a certain link if the above date variable is within 5 days of the current date or after that date? (As in, only display the link if it's 5 days until that date through any time after that date. Like, display a link from 12-26-17 through the year 2200 and any time after.) I found the "CURRENTDAY" variable on this page, but I'm not sure how I could compare it to a variable date to get something to show: https://www.vaultwiki.org/pages/Help...ariable-Syntax

      Thank you!
      Reply With Quote Reply With Quote

    2. January 1, 2018 #2
      pegasus
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • Visit Homepage
      • View Articles
      pegasus is offline
      VaultWiki Team
      Join Date
      March 28, 2004
      Location
      New York, NY
      Posts
      2,959
      Blog Entries
      18
      Rep Power
      688
      There is not currently a way to automatically formatted dates.

      It is possible to compare dates, but it is messy:
      Code:
      [if="[var]CURRENTYEAR[/var] == 2017"]
      [if="[var]CURRENTMONTH[/var] == 12"]
      [if="[var]CURRENTDAY[/var] > 25"]
      
      [comment] code for active time this year[/comment]
      
      [else /]
      
      [comment] code for earlier this year (12/1 - 12/25)[/comment]
      
      [/if]
      [else /]
      
      [comment] code for earlier this year (1/1 - 11/30)[/comment]
      
      [/if]
      [else /]
      [if="[var]CURRENTYEAR[/var] > 2017"]
      [if="[var]CURRENTYEAR[/var] < 2201"]
      
      [comment] code for future years[/comment]
      
      [else /]
      
      [comment] code for expired years[/comment]
      
      [/if]
      [else /]
      
      [comment] code for previous years (0 - 2016)[/comment]
      
      [/if][/if]
      As you can see, you would wind up with duplicate code because of spanning partial years (you could work around it by using templates). If we were to add a [var]set/get[/var] for custom variables (i.e. an implementation of "local" templates) it would improve this, as the templates may have no purpose outside of this context.
      - lead developer for VaultWiki
      Reply With Quote Reply With Quote

    3. January 1, 2018 #3
      SurferJon
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • View Articles
      SurferJon is offline
      Junior Member
      Join Date
      November 7, 2015
      Posts
      21
      Rep Power
      129
      Hm, not sure I'm approaching this right.

      Basically I will have a list of products across many pages, each with their own release date. When each product is released, I want there to be an Amazon link that links to an Amazon search with the product's name.

      Problem is most products are announced months in advanced, so to always have a link to Amazon won't be useful to visitors. So what I'm trying to do is set the template to start displaying the link a few days before the product's release. Otherwise I'd have to manually edit in the links for each product across each page.

      I tried your code (thank you so much for putting that together), but it wasn't working for me. I made it into a template and then set the date with variables on a page. However, the only thing that ever shows is " code for expired years "

      [if="[var]CURRENTYEAR[/var] == {{{year}}}"]
      [if="[var]CURRENTMONTH[/var] == {{{month}}}"]
      [if="[var]CURRENTDAY[/var] > {{{day}}}"]

      code for active time this year

      [else /]

      code for earlier this year (12/1 - 12/25)

      [/if]
      [else /]

      code for earlier this year (1/1 - 11/30)

      [/if]
      [else /]
      [if="[var]CURRENTYEAR[/var] > {{{year}}}"]
      [if="[var]CURRENTYEAR[/var] < 2201"]

      code for future years

      [else /]

      code for expired years

      [/if]
      [else /]

      code for previous years (0 - 2016)

      [/if][/if]
      I'm not smart enough to understand what this means, haha:
      If we were to add a [var]set/get[/var] for custom variables (i.e. an implementation of "local" templates) it would improve this, as the templates may have no purpose outside of this context.
      Reply With Quote Reply With Quote

    Tags for this Thread

    link

    View Tag Cloud

    Bookmarks

    Bookmarks
    • Submit to Digg Digg
    • Submit to del.icio.us del.icio.us
    • Submit to StumbleUpon StumbleUpon
    • Submit to Google Google

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  
    • BB code is On
    • Smilies are On
    • [IMG] code is Off
    • [VIDEO] code is
    • HTML code is Off

    Forum Rules

    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 1:16 PM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.