--- Brian E Boothe <[EMAIL PROTECTED]> wrote:

> i have this php code so far
> 
>  <?
>  $today = getdate();
>  $date = date("mdY", strtotime("$today"));
> $type = "LSRW";
> $job = 3;
> 
> $final = "$date$job$type";
>  echo"&nbsp;"; echo $final
>  ?>
> 
> inwhich produces: 123119693LSRW
> 
> it saying it's 1969,,   why ?? can anyone help so it says the right 
> date,         thanks

PHP's date functions use an epoch date of 1 Jan 1970 on most systems.  Time is
measured as the number of seconds since that date.  Any date time before the
epoch is expressed as a negative number.  Although it is defined for PHP, most
of the operating system variants don't work well with this.

If you need to refer to earlier dates, use MySQL's date functions.  It can
store and process dates from 1 Jan 1000 to 31 Dec 9999--a much wider range
indeed.  Hence, any comparisons, formating, or calculations should be done with
MySQL's date functions and operators.

In your case, you have tried to use getdate() in PHP.  This function returns an
array with elements for each component.  For example,

print_r(getdate());

returns

Array
(
    [seconds] => 17
    [minutes] => 46
    [hours] => 8
    [mday] => 25
    [wday] => 3
    [mon] => 6
    [year] => 2008
    [yday] => 176
    [weekday] => Wednesday
    [month] => June
    [0] => 1214408777
)

The strtotime() function is not expecting an array.  It wants a string with the
date expressed.

In your example, if you want the current server time, which is what getdate()
provides, simply use the date() function.  When only the first argument (date
format) is supplied, the current server time is used:

<?php
  $date = date("mdY");
  $type = "LSRW";
  $job = 3;
  
  $final = "$date$job$type";
  echo"&nbsp;"; echo $final;
?>

produces:

&nbsp;062520083LSRW

James


Reply via email to