www.webdeveloper.com
Results 1 to 5 of 5

Thread: Date Issues

  1. #1
    Join Date
    Apr 2012
    Posts
    3

    Question Date Issues

    I am wishing to add a page to our internal website that will show overdue accounts.

    I want to show today's date and then based off today's date show days in advance

    ie - Today's date is 2012-04-03

    3days: 2012-04-06
    7days: 2012-04-10
    30days: 2012-05-03
    90days: 2012-07-02

    I can't figure out how to add days?!?!?!

    Any and all help would be greatly appreciated

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,277
    What sort of server side scripting do you have available? PHP?

  3. #3
    Join Date
    Apr 2012
    Posts
    3

    Scripting

    The website was built with Joomla, and we do have PHP scripting but it is a very basic website

  4. #4
    Join Date
    Apr 2012
    Posts
    3

    what i am trying

    <h4>Days Calculator for the Date:
    <script type="text/javascript">//![CDATA[
    var dateselect = new Date()
    document.write(year+ "/"+ month +"/" + day)
    // ]]></script>
    </h4>
    <table id="datetable" border="1">
    <tbody>
    <tr>
    <td id="headerrow" style="text-align: center;">3 day</td>
    <td id="headerrow" style="text-align: center;">7 day</td>
    <td id="headerrow" style="text-align: center;">30 day</td>
    <td id="headerrow" style="text-align: center;">90 day</td>
    </tr>
    <tr>
    <td>
    <script type="text/javascript">// <![CDATA[
    document.write(dateselect+3);
    // ]]></script>
    </td>
    <td>
    <script type="text/javascript">// <![CDATA[
    document.write(dateselect+7);
    // ]]></script>
    </td>
    <td>
    <script type="text/javascript">// <![CDATA[
    document.write(dateselect+30);
    // ]]></script>
    </td>

  5. #5
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,277
    Quote Originally Posted by rowf33 View Post
    <h4>Days Calculator for the Date:
    <script type="text/javascript">//![CDATA[
    var dateselect = new Date()
    document.write(year+ "/"+ month +"/" + day)
    // ]]></script>
    </h4>
    <table id="datetable" border="1">
    <tbody>
    <tr>
    <td id="headerrow" style="text-align: center;">3 day</td>
    <td id="headerrow" style="text-align: center;">7 day</td>
    <td id="headerrow" style="text-align: center;">30 day</td>
    <td id="headerrow" style="text-align: center;">90 day</td>
    </tr>
    <tr>
    <td>
    <script type="text/javascript">// <![CDATA[
    document.write(dateselect+3);
    // ]]></script>
    </td>
    <td>
    <script type="text/javascript">// <![CDATA[
    document.write(dateselect+7);
    // ]]></script>
    </td>
    <td>
    <script type="text/javascript">// <![CDATA[
    document.write(dateselect+30);
    // ]]></script>
    </td>
    1) Either don't do this with JavaScript or do the whole thing with JavaScript. Vast numbers of users don't use JavaScript and they'll be thinking that you're an idiot when they see the headings but not the dates.

    2) The CDATA designations only go with XHTML but you should never use document.write with XHTML.

    3) You should not be using TABLES for layout.
    PHP Code:
    <?php

        define 
    ('DATE_FORMAT''Y-m-d');
        
        foreach (array (
    373090) as $days) echo "<div>$days days: "date (DATE_FORMATstrtotime ("+ $days days")), "</div>\n";

    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles