R2i DotNetNuke® Forum

R2i wants you to have the opportunity to ask questions, post reviews, help others or just rant and rave about DotNetNuke® or any of the R2i Modules and Skins. Our team spends hour upon hour, day after day, working on custom DotNetNuke® modules and services; please feel free to ask us anything.
 
Problem with formatting a date in ListX
Last Post 01 Oct 2009 09:26 AM by elwin. 0 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
elwinUser is Offline
New Member
New Member
Posts:27

--
01 Oct 2009 09:26 AM  
Hello,

I am using the module ListX 1.9.5 to show a page with a no. of fields.
The following code is used in the format section:

<table width="100%" cellpadding=0 cellspacing=2 border=0 class=Normal>
<tr><td width="25%"></td><td width="75%"></td></tr>
<tr><td>Name</td><td><input name='fld_Name' id=Name type='text'>
<span controltovalidate="Name"
errormessage="This field is mandatory"
display="Dynamic"
evaluationfunction="RequiredFieldValidatorEvaluateIsValid"
initialvalue=""
style="color:Red"> *</span>
</td></tr>
<tr><td>BirthDate</td><td><input name='fld_BirthDate' id=BirthDate type='text'>
<span controltovalidate="BirthDate"
errormessage="This field is mandatory"
display="Dynamic"
evaluationfunction="RequiredFieldValidatorEvaluateIsValid"
initialvalue=""
style="color:Red"> *</span>
<span controltovalidate="BirthDate"
errormessage="Input is incorrect dd-mm-yyyy"
display="Dynamic"
evaluationfunction="RegularExpressionValidatorEvaluateIsValid"
validationexpression=
"(0[1-9]|[12][0-9]|3[01])[-](0[1-9]|1[012])[-](19|20)\d\d"
initialvalue=""
style="color:Red;display:none"> (Only a correct date: dd-mm-yyyy)</span>
</td></tr>
<tr><td><br></td></tr>
<tr><td colspan="1">
<a onclick="if (typeof(Page_SmartValidate)=='function') return Page_SmartValidate();"
language="javascript"
{ACTION,RecUpdate,RecUpdate,,Message}>Send</a>
</td></tr>
</table>

The following code is used in the action section to save the record in SQL:

INSERT INTO CheckTable (Name,BirthDate)
VALUES ('@Name', [FORMAT,[@BirthDate],{0:dd/MM/yyyy}])


The problem occures when saving the date. The input is 01-06-2009 (first of June) and the following date is saved in SQL: 1894-06-27 00:00:00

How can I use formatting to save 01-06-2009 in the correct way.

Thanks in advance.

Best Regards,
Elwin.
You are not authorized to post a reply.

Active Forums 4.1
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seatle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share