close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dates in php

Thread began 6/16/2009 4:42 am by shaun.andrews | Last modified 6/18/2009 8:53 am by Ray Borduin | 2818 views | 5 replies |

shaun.andrews

Dates in php

I'm building the server validation receipes at the moment and I'm having trouble using the server validation on a date field when using php min and max dates. None of the php syntax's are working (eg, Time(); mktime(0, 0, 0, date("m"), date("d"), date("Y"));) But they work fine when you enter a fixed date.

I have created a test php page to set $time = Time(); and then echo $time; to see what the result of the server is and this results in: 1245152341

Is this correct? Is this where the problem could be occuring (a server problem) or should I be looking somewhere else for a problem??

Sign in to reply to this post

Ray BorduinWebAssist

use:

date("m/d/y",$timevalue);

to convert your time to a date value that can be validated.

Sign in to reply to this post
Did this help? Tips are appreciated...

shaun.andrews

Still not working...

I have tried entering the string you mentiond into the min date and still doesn't work.. I've tested the server by using:

$test = date("m/d/Y");

echo $test;

and this results in: 06/17/2009

So the server is working properly but when I enter in the server validation:

ALL formats - Selected

Min Date - date("m/d/Y");
Max Date - 01/01/2050

it lets any date before 01/01/2050 pass.. I can't work out why it's not working.

Sign in to reply to this post

Ray BorduinWebAssist

That is because it is not evaluating that code and it is expecting a literal date value. Try using:

Min Date: <?php echo(date("m/d/y")); ?>

although that may not work either. Does the MinDate field have a lighning bolt next to it? If not it may not work with server code by default in that field. No worries, you should be able to update the code directly.

After applying look for the line of code where your minvalue is set and post it here. I can see if the syntax looks correct and advise you on changes.

Sign in to reply to this post
Did this help? Tips are appreciated...

shaun.andrews

Hi Ray,

that code didn't work either, Here is the code that Validation toolkit posts after i have added date("m/d/Y"); as the min and 01/01/2009 as the max. And no the min and max fields do not have lightning bolts next to them:

$WAFV_Errors .= WAValidateDT(((isset($_POST["user_dob"]))?$_POST["user_dob"]:"") . "",true,"\b([12]\d|3[0-1]|0[1-9])\/(1[0-2]|0[1-9])\/\d{4}\b","date(\"m/d/Y\");","01/01/2009",false,".*","","",true,9);

Thankyou

Sign in to reply to this post

Ray BorduinWebAssist

should probably be:


$WAFV_Errors .= WAValidateDT(((isset($_POST["user_dob"]))?$_POST["user_dob"]:"") . "",true,"\b([12]\d|3[0-1]|0[1-9])\/(1[0-2]|0[1-9])\/\d{4}\b","". date(\"m/d/Y\") ."","01/01/2009",false,".*","","",true,9);

Sign in to reply to this post
Did this help? Tips are appreciated...

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...