You are here: Re: Pulling in current date and time? « PHP Programming Language « IT news, forums, messages
Re: Pulling in current date and time?

Posted by Good Man on 10/30/07 19:01

paul814@excite.com wrote in
news:1193768009.481351.191930@o3g2000hsb.googlegroups.com:

- top posting fixed -

>> You can start by reading a book, tutorial or the PHP online manual
>> which offers great assistance.
>>
>> People of this newsgroup generously offer their time to assist people
>> with PHP problems.... they don't do your homework, projects, or
>> anything else that you personally need 'done'.
>>
>> http://ca.php.net/manual/en/function.date.php


> I can get the date to show up...thats not the issue.
> to get the current date I do this:
> <?php
> putenv('TZ=America/New_York');
> echo date("Y-m-d h:i:s", time());
> ?>
> And the current date is displayed.
>
> I want to get that current date in the value of my textbox named
> editorialdate so that it is auto filled in on load of page.
>
> If I try to surround this:
>
> Date:
>
> <br>
> <input type="text" name="editorialDate" size="20" maxlength="25">
> <br>
>
> in <?php tags I get an error on the page. So I just want to make the
> value of the textbox be equal to what I can already display on the
> page.

Are you familiar with how to echo/print PHP variables to HTML? You
should be.

<?php
putenv('TZ=America/New_York');
$theDate = date("Y-m-d h:i:s", time());
?>

.... then all your form stuff (OUTSIDE THE PHP!!)

.... with your input like:

<input type="text" name="editorialDate" value="<?php echo $theDate; ?>">


.... you should do a PHP tutorial or something, it's hard to get more
basic than this.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация