close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Date

Thread began 9/19/2011 1:40 am by superpac250441 | Last modified 9/26/2011 8:49 am by superpac250441 | 845 views | 8 replies |

superpac250441

Date

I am wishing to build a registration form(2) using SA2. There will be one for the user to register and one for the Admin to register.
The user will have the registration date hidden form element, a date stamp? The admin will have a WA date picker. Is there a way to have them both show YYYY-MM-DD? I know you can do this in datepicker but how can this be done with a hidden form element so they are both the same?
Thanks

Sign in to reply to this post

Dave BuchholzBeta Tester

Like so:

php:
<input type="hidden" name="tstamp" id="tstamp" value="<?php echo date('Y-m-d'time()); ?>" />



this will print the current server date into the value of the hidden form element.

Sign in to reply to this post

superpac250441

Thanks Dave. The reason why I haven't got back to you about the gateway is that I have been having big problems and consequent serious delays with SA2 issues. I hope to have it resolved and get the files to you early next week so you can complete the asssignment.
Thanks
Chris

Sign in to reply to this post

Dave BuchholzBeta Tester

Chris,

no worries and no rush I am booked up to the end of october at the moment

Sign in to reply to this post

superpac250441

just to clarify, The date picker format selected is yyyy-mm-dd for the admin area. For users, if I use <?php echo date('Y-m-d', time()); ?> won't it put in the time as well? So that they are exactly the same, should I not use <?php echo date('Y-m-d'); ?> ???? I am just guessing but can someone confirm either way? Thanks

Sign in to reply to this post

Dave BuchholzBeta Tester

No it doesn't work like that, the datepicker fills the value of the form field via javascript with the format yyyy-mm-dd

when using php to fill the form value I always give it the value of time() to create the date from as this will be the "correct" date/time rather than the server time which can be incorrect this is especially true when hosting uk sites on a us server

I use this in conjunction with this code in my application file

php:
/*

Set Timezone
---------------------------------------------------------- 
*/

ini_set('date.timezone', 'Europe/London');



to set the correct time zone

So <?php echo date('Y-m-d', time()); ?> wil populate the hidden form field with a date formatted like yyyy-mm-dd

Sign in to reply to this post

superpac250441

Following on from what you have said, can I do this:

Top line of code add this:
<?php
date_default_timezone_set("Africa/Johannesburg");
?>

For registration date:
<?php echo date('Y-m-d', time()); ?>

For expiry date - exactly 1 year later:
<?php echo(date("Y-m-d h:m:s", mktime(date("h"), date("m"), date("s"), date("m"), date("d"), date("Y") + 1))); ?>

Thanks

Sign in to reply to this post

Dave BuchholzBeta Tester

without checking the manual that looks about right

Sign in to reply to this post

superpac250441

Thanks a million Dave

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...