Mac
Posts: 37
|
Posted: 06/12/2006, 3:21 AM |
|
Could somebody pease point me at the documentation for this function? I can't seem to track it down.
And now for the really silly question, can it be used to subtract also? (ok ok I know it says ADD but adding - to something is a sutraction).
Thanks in advance.
_________________
/\/\@< |
|
|
mamboBROWN
Posts: 1713
|
Posted: 06/12/2006, 7:24 PM |
|
Mac
CCS Date function that I know about is CCFormatDate.
Try this link: http://docs.codecharge.com/studio3/html/Components/Func...FormatDate.html
|
|
|
mamboBROWN
Posts: 1713
|
Posted: 06/12/2006, 7:27 PM |
|
Mac
Also, don't forget that you can use a database query to do the hard work for you and all you have to do is display the date. Just another suggestion. I am also assuming that you are using MySQL. If not please let us know...
|
|
|
Mac
Posts: 37
|
Posted: 06/12/2006, 8:24 PM |
|
Cheers mambo, from what I can make out CCFormatDate just formats dates? (odd that considerning the name eh? hehe).
I am using mySQL yes, not sure that helps with what I am trying to do.
I need to validate that a date of birth is within a certain range of years from today, basically the person filling in the form must be between 18 and 65 (no not a porn site, I'm developing an insurance quote system).
I was hoping to avoid string slicing the date, plus there is the headache of leap years etc.. from what I gathered from the forum CCDateAdd could be used to add to dates.
I'll just have to do it the hard way I guess, but thanks for trying to help.
_________________
/\/\@< |
|
|
WKempees
|
Posted: 06/13/2006, 4:23 AM |
|
CCDateAdd(Date, String)
It is a function in Common.php
It will accept a valid date as first parameter, to be used as a start date.
It will accept a string as second parameter in the format "nn xxxxxx"
example : "1d","1day", "111days", same for w/week/weeks an y/year/years
will return a valid date, <b>negative values</b> are allowed.
Important to format the inputdate to the correct format.
Example
On a Form with 3 TextBoxes where TextBox1 is set to CurrentDate
TextBox2 is the Resultfield and TextBox3 can contain the additionstring
in the BeforeShow of TextBox2:
$MyDate = CCParseDate(CCFormatDate($Container->TextBox1->GetValue(),
array("yyyy", "-", "mm","-","dd")), array("yyyy", "-", "mm", "-", "dd", " ",
"HH", ":", "nn", ":", "ss"));
$Component->SetValue( CCDateAdd( $MyDate, $Container->TextBox3 ) );
Nice name for a function CCDateAdd.
Walter
|
|
|
Mac
Posts: 37
|
Posted: 06/13/2006, 5:06 AM |
|
Do you happen to know if it will accept a negative Walter? Something like -10y ?
_________________
/\/\@< |
|
|
WKempees
|
Posted: 06/13/2006, 5:12 AM |
|
Quote :
will return a valid date, <b>negative values</b> are allowed
Yes it will, example "-1month"
Walter
|
|
|
Mac
Posts: 37
|
Posted: 06/13/2006, 5:30 AM |
|
Ahh thats simply spiffing!
Thanks guys.
_________________
/\/\@< |
|
|
|