php "date()" function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Westcoast Sheri

    php "date()" function

    When I used the "date("nj") " function to generate an invoice, about 1
    out of 500 times, nothing comes up

    <?php
    $invoicedate = date("nj");
    ?>
    <html><head></head><body>
    Invoice date:
    <?php
    print $invoicedate;
    ?>
    </body></html>

    So, when I noticed some invoices were missing dates, I tried this:

    <?php
    $invoicedate = date("nj");
    ?>
    <html><head></head><body>
    Invoice date:
    <?php
    if (!invoicedate) {
    $invoicedate = date("nj");
    }
    print $invoicedate;
    ?>
    </body></html>

    But, still, 1 out of 500 times, no date prints to browser.

    My question is: On some web-servers, does the date() function not always
    work? If not, then why not?



  • kingofkolt

    #2
    Re: php &quot;date()&qu ot; function

    "Westcoast Sheri" <sheri_deb88@no spamun8nospam.c om> wrote in message
    news:40C8D5CF.5 06A44DB@nospamu n8nospam.com...[color=blue]
    > When I used the "date("nj") " function to generate an invoice, about 1
    > out of 500 times, nothing comes up
    >
    > <?php
    > $invoicedate = date("nj");
    > ?>
    > <html><head></head><body>
    > Invoice date:
    > <?php
    > print $invoicedate;
    > ?>
    > </body></html>
    >
    > So, when I noticed some invoices were missing dates, I tried this:
    >
    > <?php
    > $invoicedate = date("nj");
    > ?>
    > <html><head></head><body>
    > Invoice date:
    > <?php
    > if (!invoicedate) {
    > $invoicedate = date("nj");
    > }
    > print $invoicedate;
    > ?>
    > </body></html>
    >
    > But, still, 1 out of 500 times, no date prints to browser.
    >
    > My question is: On some web-servers, does the date() function not always
    > work? If not, then why not?
    >
    >
    >[/color]

    This won't completely answer your question, but one problem I did notice in
    your second example was that you left out the dollar sign $ in the if
    statement on line 7:

    if (!invoicedate) {

    should be

    if (!$invoicedate) {

    - JP


    Comment

    • Westcoast Sheri

      #3
      Re: php &quot;date()&qu ot; function

      kingofkolt wrote:
      [color=blue]
      > "Westcoast Sheri" <sheri_deb88@no spamun8nospam.c om> wrote in message
      > news:40C8D5CF.5 06A44DB@nospamu n8nospam.com...[color=green]
      > > When I used the "date("nj") " function to generate an invoice, about 1
      > > out of 500 times, nothing comes up
      > >
      > > <?php
      > > $invoicedate = date("nj");
      > > ?>
      > > <html><head></head><body>
      > > Invoice date:
      > > <?php
      > > print $invoicedate;
      > > ?>
      > > </body></html>
      > >
      > > So, when I noticed some invoices were missing dates, I tried this:
      > >
      > > <?php
      > > $invoicedate = date("nj");
      > > ?>
      > > <html><head></head><body>
      > > Invoice date:
      > > <?php
      > > if (!invoicedate) {
      > > $invoicedate = date("nj");
      > > }
      > > print $invoicedate;
      > > ?>
      > > </body></html>
      > >
      > > But, still, 1 out of 500 times, no date prints to browser.
      > >
      > > My question is: On some web-servers, does the date() function not always
      > > work? If not, then why not?
      > >
      > >
      > >[/color]
      >
      > This won't completely answer your question, but one problem I did notice in
      > your second example was that you left out the dollar sign $ in the if
      > statement on line 7:
      >
      > if (!invoicedate) {
      >
      > should be
      >
      > if (!$invoicedate) {
      >
      > - JP[/color]

      Oops, just a typo in this newsgroup only, not in script.


      Comment

      Working...