473,836 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateTimePicker Problem !

106 New Member
Hi,
I have a problem with my DateTimePicker javascript code which i downloaded , the problem is when i pick the date and the date appears in my Text Field and i click Submit the date which i picked is not sent to the DB and instead the default value of the text field which is 00-00-0000 is Sent

so what i need is to make the value i picked replace the value of the Text Field
and i cant seem to get the Js code which i downloaded . i'm new to Javascript

Expand|Select|Wrap|Line Numbers
  1. //Javascript name: My Date Time Picker
  2. //Date created: 16-Nov-2003 23:19
  3. //Scripter: TengYong Ng
  4. //Website: http://www.rainforestnet.com
  5. //Copyright (c) 2003 TengYong Ng
  6. //FileName: DateTimePicker.js
  7. //Version: 0.8
  8. //Contact: contact@rainforestnet.com
  9. // Note: Permission given to use this script in ANY kind of applications if
  10. //       header lines are left unchanged.
  11.  
  12. //Global variables
  13. var winCal;
  14. var dtToday=new Date();
  15. var Cal;
  16. var docCal;
  17. var MonthName=["January", "February", "March", "April", "May", "June","July", 
  18.     "August", "September", "October", "November", "December"];
  19. var WeekDayName=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];    
  20. var exDateTime;//Existing Date and Time
  21.  
  22. //Configurable parameters
  23. var cnTop="200";//top coordinate of calendar window.
  24. var cnLeft="500";//left coordinate of calendar window
  25. var WindowTitle ="DateTime Picker";//Date Time Picker title.
  26. var WeekChar=2;//number of character for week day. if 2 then Mo,Tu,We. if 3 then Mon,Tue,Wed.
  27. var CellWidth=20;//Width of day cell.
  28. var DateSeparator="-";//Date Separator, you can change it to "/" if you want.
  29. var TimeMode=24;//default TimeMode value. 12 or 24
  30.  
  31. var ShowLongMonth=true;//Show long month name in Calendar header. example: "January".
  32. var ShowMonthYear=true;//Show Month and Year in Calendar header.
  33. var MonthYearColor="#cc0033";//Font Color of Month and Year in Calendar header.
  34. var WeekHeadColor="#0099CC";//Background Color in Week header.
  35. var SundayColor="#6699FF";//Background color of Sunday.
  36. var SaturdayColor="#CCCCFF";//Background color of Saturday.
  37. var WeekDayColor="white";//Background color of weekdays.
  38. var FontColor="blue";//color of font in Calendar day cell.
  39. var TodayColor="#FFFF33";//Background color of today.
  40. var SelDateColor="#FFFF99";//Backgrond color of selected date in textbox.
  41. var YrSelColor="#cc0033";//color of font of Year selector.
  42. var ThemeBg="";//Background image of Calendar window.
  43. //end Configurable parameters
  44. //end Global variable
  45.  
  46. function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)
  47. {
  48.     if (document.getElementById(pCtrl).disabled) return;
  49.  
  50.     Cal=new Calendar(dtToday);
  51.     if ((pShowTime!=null) && (pShowTime))
  52.     {
  53.         Cal.ShowTime=true;
  54.         if ((pTimeMode!=null) &&((pTimeMode=='12')||(pTimeMode=='24')))
  55.         {
  56.             TimeMode=pTimeMode;
  57.         }        
  58.     }    
  59.     if (pCtrl!=null)
  60.         Cal.Ctrl=pCtrl;
  61.     if (pFormat!=null)
  62.         Cal.Format=pFormat.toUpperCase();
  63.  
  64.     exDateTime=document.getElementById(pCtrl).value;
  65.     if (exDateTime!="")//Parse Date String
  66.     {
  67.         var Sp1;//Index of Date Separator 1
  68.         var Sp2;//Index of Date Separator 2 
  69.         var tSp1;//Index of Time Separator 1
  70.         var tSp1;//Index of Time Separator 2
  71.         var strMonth;
  72.         var strDate;
  73.         var strYear;
  74.         var intMonth;
  75.         var YearPattern;
  76.         var strHour;
  77.         var strMinute;
  78.         var strSecond;
  79.         //parse month
  80.         Sp1=exDateTime.indexOf(DateSeparator,0)
  81.         Sp2=exDateTime.indexOf(DateSeparator,(parseInt(Sp1)+1));
  82.  
  83.         if ((Cal.Format.toUpperCase()=="DDMMYYYY") || (Cal.Format.toUpperCase()=="DDMMMYYYY"))
  84.         {
  85.             strMonth=exDateTime.substring(Sp1+1,Sp2);
  86.             strDate=exDateTime.substring(0,Sp1);
  87.         }
  88.         else if ((Cal.Format.toUpperCase()=="MMDDYYYY") || (Cal.Format.toUpperCase()=="MMMDDYYYY"))
  89.         {
  90.             strMonth=exDateTime.substring(0,Sp1);
  91.             strDate=exDateTime.substring(Sp1+1,Sp2);
  92.         }
  93.         if (isNaN(strMonth))
  94.             intMonth=Cal.GetMonthIndex(strMonth);
  95.         else
  96.             intMonth=parseInt(strMonth,10)-1;    
  97.         if ((parseInt(intMonth,10)>=0) && (parseInt(intMonth,10)<12))
  98.             Cal.Month=intMonth;
  99.         //end parse month
  100.         //parse Date
  101.         if ((parseInt(strDate,10)<=Cal.GetMonDays()) && (parseInt(strDate,10)>=1))
  102.             Cal.Date=strDate;
  103.         //end parse Date
  104.         //parse year
  105.         strYear=exDateTime.substring(Sp2+1,Sp2+5);
  106.         YearPattern=/^\d{4}$/;
  107.         if (YearPattern.test(strYear))
  108.             Cal.Year=parseInt(strYear,10);
  109.         //end parse year
  110.         //parse time
  111.         if (Cal.ShowTime==true)
  112.         {
  113.             tSp1=exDateTime.indexOf(":",0)
  114.             tSp2=exDateTime.indexOf(":",(parseInt(tSp1)+1));
  115.             strHour=exDateTime.substring(tSp1,(tSp1)-2);
  116.             Cal.SetHour(strHour);
  117.             strMinute=exDateTime.substring(tSp1+1,tSp2);
  118.             Cal.SetMinute(strMinute);
  119.             strSecond=exDateTime.substring(tSp2+1,tSp2+3);
  120.             Cal.SetSecond(strSecond);
  121.         }    
  122.     }
  123.     winCal=window.open("","DateTimePicker","toolbar=0,status=0,menubar=0,fullscreen=no,width=250,height=245,resizable=0,top="+cnTop+",left="+cnLeft);
  124.     docCal=winCal.document;
  125.     RenderCal();
  126. }
  127.  
  128. function RenderCal()
  129. {
  130.     var vCalHeader;
  131.     var vCalData;
  132.     var vCalTime;
  133.     var i;
  134.     var j;
  135.     var SelectStr;
  136.     var vDayCount=0;
  137.     var vFirstDay;
  138.  
  139.     docCal.open();
  140.     docCal.writeln("<html><head><title>"+WindowTitle+"</title>");
  141.     docCal.writeln("<script>var winMain=window.opener;</script>");
  142.     docCal.writeln("</head><body background='"+ThemeBg+"' link="+FontColor+" vlink="+FontColor+"><form name='Calendar'>");
  143.  
  144.     vCalHeader="<table border=1 cellpadding=1 cellspacing=1 width='100%' align=\"center\" valign=\"top\">\n";
  145.     //Month Selector
  146.     vCalHeader+="<tr>\n<td colspan='7'><table border=0 width='100%' cellpadding=0 cellspacing=0><tr><td align='left'>\n";
  147.     vCalHeader+="<select name=\"MonthSelector\" onChange=\"javascript:winMain.Cal.SwitchMth(this.selectedIndex);winMain.RenderCal();\">\n";
  148.     for (i=0;i<12;i++)
  149.     {
  150.         if (i==Cal.Month)
  151.             SelectStr="Selected";
  152.         else
  153.             SelectStr="";    
  154.         vCalHeader+="<option "+SelectStr+" value >"+MonthName[i]+"\n";
  155.     }
  156.     vCalHeader+="</select></td>";
  157.     //Year selector
  158.     vCalHeader+="\n<td align='right'><a href=\"javascript:winMain.Cal.DecYear();winMain.RenderCal()\"><b><font color=\""+YrSelColor+"\"><</font></b></a><font face=\"Verdana\" color=\""+YrSelColor+"\" size=2><b> "+Cal.Year+" </b></font><a href=\"javascript:winMain.Cal.IncYear();winMain.RenderCal()\"><b><font color=\""+YrSelColor+"\">></font></b></a></td></tr></table></td>\n";    
  159.     vCalHeader+="</tr>";
  160.     //Calendar header shows Month and Year
  161.     if (ShowMonthYear)
  162.         vCalHeader+="<tr><td colspan='7'><font face='Verdana' size='2' align='center' color='"+MonthYearColor+"'><b>"+Cal.GetMonthName(ShowLongMonth)+" "+Cal.Year+"</b></font></td></tr>\n";
  163.     //Week day header
  164.     vCalHeader+="<tr bgcolor="+WeekHeadColor+">";
  165.     for (i=0;i<7;i++)
  166.     {
  167.         vCalHeader+="<td align='center'><font face='Verdana' size='2'>"+WeekDayName[i].substr(0,WeekChar)+"</font></td>";
  168.     }
  169.     vCalHeader+="</tr>";    
  170.     docCal.write(vCalHeader);
  171.  
  172.     //Calendar detail
  173.     CalDate=new Date(Cal.Year,Cal.Month);
  174.     CalDate.setDate(1);
  175.     vFirstDay=CalDate.getDay();
  176.     vCalData="<tr>";
  177.     for (i=0;i<vFirstDay;i++)
  178.     {
  179.         vCalData=vCalData+GenCell();
  180.         vDayCount=vDayCount+1;
  181.     }
  182.     for (j=1;j<=Cal.GetMonDays();j++)
  183.     {
  184.         var strCell;
  185.         vDayCount=vDayCount+1;
  186.         if ((j==dtToday.getDate())&&(Cal.Month==dtToday.getMonth())&&(Cal.Year==dtToday.getFullYear()))
  187.             strCell=GenCell(j,true,TodayColor);//Highlight today's date
  188.         else
  189.         {
  190.             if (j==Cal.Date)
  191.             {
  192.                 strCell=GenCell(j,true,SelDateColor);
  193.             }
  194.             else
  195.             {     
  196.                 if (vDayCount%7==0)
  197.                     strCell=GenCell(j,false,SaturdayColor);
  198.                 else if ((vDayCount+6)%7==0)
  199.                     strCell=GenCell(j,false,SundayColor);
  200.                 else
  201.                     strCell=GenCell(j,null,WeekDayColor);
  202.             }        
  203.         }                        
  204.         vCalData=vCalData+strCell;
  205.  
  206.         if((vDayCount%7==0)&&(j<Cal.GetMonDays()))
  207.         {
  208.             vCalData=vCalData+"</tr>\n<tr>";
  209.         }
  210.     }
  211.     docCal.writeln(vCalData);    
  212.     //Time picker
  213.     if (Cal.ShowTime)
  214.     {
  215.         var showHour;
  216.         showHour=Cal.getShowHour();        
  217.         vCalTime="<tr>\n<td colspan='7' align='center'>";
  218.         vCalTime+="<input type='text' name='hour' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+showHour+" onchange=\"javascript:winMain.Cal.SetHour(this.value)\">";
  219.         vCalTime+=" : ";
  220.         vCalTime+="<input type='text' name='minute' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+Cal.Minutes+" onchange=\"javascript:winMain.Cal.SetMinute(this.value)\">";
  221.         vCalTime+=" : ";
  222.         vCalTime+="<input type='text' name='second' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+Cal.Seconds+" onchange=\"javascript:winMain.Cal.SetSecond(this.value)\">";
  223.         if (TimeMode==12)
  224.         {
  225.             var SelectAm =(parseInt(Cal.Hours,10)<12)? "Selected":"";
  226.             var SelectPm =(parseInt(Cal.Hours,10)>=12)? "Selected":"";
  227.  
  228.             vCalTime+="<select name=\"ampm\" onchange=\"javascript:winMain.Cal.SetAmPm(this.options[this.selectedIndex].value);\">";
  229.             vCalTime+="<option "+SelectAm+" value=\"AM\">AM</option>";
  230.             vCalTime+="<option "+SelectPm+" value=\"PM\">PM<option>";
  231.             vCalTime+="</select>";
  232.         }    
  233.         vCalTime+="\n</td>\n</tr>";
  234.         docCal.write(vCalTime);
  235.     }    
  236.     //end time picker
  237.     docCal.writeln("\n</table>");
  238.     docCal.writeln("</form></body></html>");
  239.     docCal.close();
  240. }
  241.  
  242. function GenCell(pValue,pHighLight,pColor)//Generate table cell with value
  243. {
  244.     var PValue;
  245.     var PCellStr;
  246.     var vColor;
  247.     var vHLstr1;//HighLight string
  248.     var vHlstr2;
  249.     var vTimeStr;
  250.  
  251.     if (pValue==null)
  252.         PValue="";
  253.     else
  254.         PValue=pValue;
  255.  
  256.     if (pColor!=null)
  257.         vColor="bgcolor=\""+pColor+"\"";
  258.     else
  259.         vColor="";    
  260.     if ((pHighLight!=null)&&(pHighLight))
  261.         {vHLstr1="color='red'><b>";vHLstr2="</b>";}
  262.     else
  263.         {vHLstr1=">";vHLstr2="";}    
  264.  
  265.     if (Cal.ShowTime)
  266.     {
  267.         vTimeStr="winMain.document.getElementById('"+Cal.Ctrl+"').value+=' '+"+"winMain.Cal.getShowHour()"+"+':'+"+"winMain.Cal.Minutes"+"+':'+"+"winMain.Cal.Seconds";
  268.         if (TimeMode==12)
  269.             vTimeStr+="+' '+winMain.Cal.AMorPM";
  270.     }    
  271.     else
  272.         vTimeStr="";        
  273.     PCellStr="<td "+vColor+" width="+CellWidth+" align='center'><font face='verdana' size='2'"+vHLstr1+"<a href=\"javascript:winMain.document.getElementById('"+Cal.Ctrl+"').value='"+Cal.FormatDate(PValue)+"';"+vTimeStr+";window.close();\">"+PValue+"</a>"+vHLstr2+"</font></td>";
  274.     var myDate=Cal.FormatDate(PValue);
  275.     return PCellStr;
  276. }
  277.  
  278. function Calendar(pDate,pCtrl)
  279. {    
  280.     //Properties
  281.     this.Date=pDate.getDate();//selected date
  282.     this.Month=pDate.getMonth();//selected month number
  283.     this.Year=pDate.getFullYear();//selected year in 4 digits
  284.     this.Hours=pDate.getHours();    
  285.  
  286.     if (pDate.getMinutes()<10)
  287.         this.Minutes="0"+pDate.getMinutes();
  288.     else
  289.         this.Minutes=pDate.getMinutes();
  290.  
  291.     if (pDate.getSeconds()<10)
  292.         this.Seconds="0"+pDate.getSeconds();
  293.     else        
  294.         this.Seconds=pDate.getSeconds();
  295.  
  296.     this.MyWindow=winCal;
  297.     this.Ctrl=pCtrl;
  298.     this.Format="ddMMyyyy";
  299.     this.Separator=DateSeparator;
  300.     this.ShowTime=false;
  301.     if (pDate.getHours()<12)
  302.         this.AMorPM="AM";
  303.     else
  304.         this.AMorPM="PM";    
  305. }
  306.  
  307. function GetMonthIndex(shortMonthName)
  308. {
  309.     for (i=0;i<12;i++)
  310.     {
  311.         if (MonthName[i].substring(0,3).toUpperCase()==shortMonthName.toUpperCase())
  312.         {    return i;}
  313.     }
  314. }
  315. Calendar.prototype.GetMonthIndex=GetMonthIndex;
  316.  
  317. function IncYear()
  318. {    Cal.Year++;}
  319. Calendar.prototype.IncYear=IncYear;
  320.  
  321. function DecYear()
  322. {    Cal.Year--;}
  323. Calendar.prototype.DecYear=DecYear;
  324.  
  325. function SwitchMth(intMth)
  326. {    Cal.Month=intMth;}
  327. Calendar.prototype.SwitchMth=SwitchMth;
  328.  
  329. function SetHour(intHour)
  330. {    
  331.     var MaxHour;
  332.     var MinHour;
  333.     if (TimeMode==24)
  334.     {    MaxHour=23;MinHour=0}
  335.     else if (TimeMode==12)
  336.     {    MaxHour=12;MinHour=1}
  337.     else
  338.         alert("TimeMode can only be 12 or 24");        
  339.     var HourExp=new RegExp("^\\d\\d$");
  340.     if (HourExp.test(intHour) && (parseInt(intHour,10)<=MaxHour) && (parseInt(intHour,10)>=MinHour))
  341.     {    
  342.         if ((TimeMode==12) && (Cal.AMorPM=="PM"))
  343.         {
  344.             if (parseInt(intHour,10)==12)
  345.                 Cal.Hours=12;
  346.             else    
  347.                 Cal.Hours=parseInt(intHour,10)+12;
  348.         }    
  349.         else if ((TimeMode==12) && (Cal.AMorPM=="AM"))
  350.         {
  351.             if (intHour==12)
  352.                 intHour-=12;
  353.             Cal.Hours=parseInt(intHour,10);
  354.         }
  355.         else if (TimeMode==24)
  356.             Cal.Hours=parseInt(intHour,10);    
  357.     }
  358. }
  359. Calendar.prototype.SetHour=SetHour;
  360.  
  361. function SetMinute(intMin)
  362. {
  363.     var MinExp=new RegExp("^\\d\\d$");
  364.     if (MinExp.test(intMin) && (intMin<60))
  365.         Cal.Minutes=intMin;
  366. }
  367. Calendar.prototype.SetMinute=SetMinute;
  368.  
  369. function SetSecond(intSec)
  370. {    
  371.     var SecExp=new RegExp("^\\d\\d$");
  372.     if (SecExp.test(intSec) && (intSec<60))
  373.         Cal.Seconds=intSec;
  374. }
  375. Calendar.prototype.SetSecond=SetSecond;
  376.  
  377. function SetAmPm(pvalue)
  378. {
  379.     this.AMorPM=pvalue;
  380.     if (pvalue=="PM")
  381.     {
  382.         this.Hours=(parseInt(this.Hours,10))+12;
  383.         if (this.Hours==24)
  384.             this.Hours=12;
  385.     }    
  386.     else if (pvalue=="AM")
  387.         this.Hours-=12;    
  388. }
  389. Calendar.prototype.SetAmPm=SetAmPm;
  390.  
  391. function getShowHour()
  392. {
  393.     var finalHour;
  394.     if (TimeMode==12)
  395.     {
  396.         if (parseInt(this.Hours,10)==0)
  397.         {
  398.             this.AMorPM="AM";
  399.             finalHour=parseInt(this.Hours,10)+12;    
  400.         }
  401.         else if (parseInt(this.Hours,10)==12)
  402.         {
  403.             this.AMorPM="PM";
  404.             finalHour=12;
  405.         }        
  406.         else if (this.Hours>12)
  407.         {
  408.             this.AMorPM="PM";
  409.             if ((this.Hours-12)<10)
  410.                 finalHour="0"+((parseInt(this.Hours,10))-12);
  411.             else
  412.                 finalHour=parseInt(this.Hours,10)-12;    
  413.         }
  414.         else
  415.         {
  416.             this.AMorPM="AM";
  417.             if (this.Hours<10)
  418.                 finalHour="0"+parseInt(this.Hours,10);
  419.             else
  420.                 finalHour=this.Hours;    
  421.         }
  422.     }
  423.     else if (TimeMode==24)
  424.     {
  425.         if (this.Hours<10)
  426.             finalHour="0"+parseInt(this.Hours,10);
  427.         else    
  428.             finalHour=this.Hours;
  429.     }    
  430.     return finalHour;    
  431. }                
  432. Calendar.prototype.getShowHour=getShowHour;        
  433.  
  434. function GetMonthName(IsLong)
  435. {
  436.     var Month=MonthName[this.Month];
  437.     if (IsLong)
  438.         return Month;
  439.     else
  440.         return Month.substr(0,3);
  441. }
  442. Calendar.prototype.GetMonthName=GetMonthName;
  443.  
  444. function GetMonDays()//Get number of days in a month
  445. {
  446.     var DaysInMonth=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  447.     if (this.IsLeapYear())
  448.     {
  449.         DaysInMonth[1]=29;
  450.     }    
  451.     return DaysInMonth[this.Month];    
  452. }
  453. Calendar.prototype.GetMonDays=GetMonDays;
  454.  
  455. function IsLeapYear()
  456. {
  457.     if ((this.Year%4)==0)
  458.     {
  459.         if ((this.Year%100==0) && (this.Year%400)!=0)
  460.         {
  461.             return false;
  462.         }
  463.         else
  464.         {
  465.             return true;
  466.         }
  467.     }
  468.     else
  469.     {
  470.         return false;
  471.     }
  472. }
  473. Calendar.prototype.IsLeapYear=IsLeapYear;
  474.  
  475. function FormatDate(pDate)
  476. {
  477.     if (this.Format.toUpperCase()=="DDMMYYYY")
  478.         return (pDate+DateSeparator+(this.Month+1)+DateSeparator+this.Year);
  479.     else if (this.Format.toUpperCase()=="DDMMMYYYY")
  480.         return (pDate+DateSeparator+this.GetMonthName(false)+DateSeparator+this.Year);
  481.     else if (this.Format.toUpperCase()=="MMDDYYYY")
  482.         return ((this.Month+1)+DateSeparator+pDate+DateSeparator+this.Year);
  483.     else if (this.Format.toUpperCase()=="MMMDDYYYY")
  484.         return (this.GetMonthName(false)+DateSeparator+pDate+DateSeparator+this.Year);    
  485.  
  486. }
  487. Calendar.prototype.FormatDate=For
matDate;
Dec 15 '08 #1
11 5029
acoder
16,027 Recognized Expert Moderator MVP
Can you show the code of the text field in question.
Dec 15 '08 #2
clain
79 New Member
i think there is multiple posting .... or there should be some function or event that triggers before actual posting is done..... which changes the text value
Dec 16 '08 #3
jessy
106 New Member
Expand|Select|Wrap|Line Numbers
  1. while($row=mysql_fetch_array($query))
  2.                    {     $shipping_date=$row[shipping_date];
  3.  
  4. <td><input type="text" id="demo<?echo$count?>" name="date[]" value="<?=$shipping_date?>" disabled="disabled"><a href="javascript:NewCal('demo<?echo$count?>','ddmmyyyy')"><img src="/images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a></td>
  5.  
  6.               }
the text field is first shown as disabled with the shipping date 00-00-0000 then upon making a select it chages into enabled through Js.
anyway, thats not the problem ...the problem is when its enabled and i click on the calendar icon and opens a popup i choose the date and it's successfully added to the Enabled text field But seems its not actually added !!
Dec 16 '08 #4
jessy
106 New Member
@clain

Yes, Can u plz show me an example of how to do That ?!
Dec 17 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
When the text box is enabled and the value is set, check the value in the DOM in your debugger, e.g. Firebug.
Dec 17 '08 #6
hsriat
1,654 Recognized Expert Top Contributor
If you can see the value of new date before you click submit, then I think, may be you are doing some validation onclick of the submit button which is messing up the values in the input.

Or just check on the PHP end what is being posted by the form.
Add <?php print_r($_POST) ?> in the beginning of your php of the target page.
Dec 17 '08 #7
jessy
106 New Member
Yes, I can see the Value of the new Date before i click Submit ... but only i can see it in the text field ...but when i click ViewSource to check if the date was in the text field value But it's not !!
Expand|Select|Wrap|Line Numbers
  1. value=""
im not doing anything on the Submit and not using onclick !!
i tried to contact the author but seems he is no longer in the field of programming :D
how lucky i am
Dec 18 '08 #8
jessy
106 New Member
Thanks People for your Help
seems the problem was in the DB field !!
it was set to DATE and the sql date format yyyy-mm-dd while the date fetched from the calendar was dd-mm-yyyy so i changed it to VARCHAR and the problem was solved But after i Lost some of my Hair
Dec 18 '08 #9
acoder
16,027 Recognized Expert Moderator MVP
Glad you solved your problem and thanks for posting the solution. It may have been a good idea to keep the date type and changed the input to match the type because DATE is a lot more useful than VARCHAR.
Dec 18 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
501
by: Angelina | last post by:
Hi, I have got two DateTimePicker's on my form to accept a guest arrival date and departure date.what i want to acheieve is ensure that the DateTimePicker2 (departure) is always greater than DateTimePicker1 (arrival date). can anyone help me on the code for this? as u can tell, im new learner. i also want the days between the arrival date and
9
3978
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine when using the control on a win2k machine but if we use it on a win XP box and call
1
6279
by: John Smith | last post by:
Hey folks, Got some strange behavior going on here. I have a datetimepicker with showcheckbox = true; If I set Checked=true and set the Text of the datetimepicker, then then the Checked property is always = true....even after the user unchecks the checkbox. This is fully reproducable.
0
1660
by: ROG | last post by:
Hi all with help from postings on the web, i have a dateTimePicker in one of my columns in the datagrid. However, when i move in to this column using the arrow keys, it automatically pops up, and then any future arrow key presses start changing the date. I don't want this to happen - i'd like the arrow keys to continue navigating around the grid. For the dateTimePicker to become "active", i'd like the user to, say, have to press...
0
2180
by: Sumit | last post by:
Hi all, I have a datetimepicker on my windows form. When the user selects it i check whether the date entered is a Sunday or not & if its not a sunday i want that the control remains on the DateTimePicker & the DateTimePicker is displayed in its expaned form (i.e displaying the calendar). If i do a datetimepicker.focus(), then the focus goes to the datetimepicker but the user who is using it might ignore the focus as
4
5687
by: Jacek Jurkowski | last post by:
.... the minimum date of DateTimePicker is 1753-01-01. How to make DateTime to do not show nothing in its text if this date is the value? I have a form with a field LastLogonDate. If user hasn't logon yet this date should be empty but when binding a property to the DateTimePicker value it always shows value parsed prom property which is 1753-01-01. How to make an "empty" or "not set" date bindable to a value property of DateTimePicker?
7
6221
by: Clamara | last post by:
When adding a new record from my form, I pre-set my DateTimePicker's value to System.DateTime.Today Since the "Today" value is used most of the time, the user doesn't need to select a date from the DateTimePicker, since the default is shown. My problem is, if the user does not choose a value from the DateTimePicker (because using the default is good enough), then during database update, the date value is not saved to the database; while if...
3
6401
by: Charlie | last post by:
In the top portion of the DateTimePicker, where the value of the date is displayed, how can I detect whether the month or day or year is currently focused, or, if ShowCheckBox = True, whether the checkbox is focused?
3
7531
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going on. It's a simple program that loads a control onto a form and binds "Foo" against a combobox ("SelectedItem") for it's "Bar" property and a datetimepicker ("Value") for it's "DateTime" property. The DateTimePicker.Visible value is set to...
4
3307
by: jehugaleahsa | last post by:
Hello: We were hoping to allow users to have DateTimePicker value null so that a unused date is stored on a Database. Does the control support this? I am pretty sure it doesn't. How would you go about representing this to a user so they are not confused? Thanks,
0
9820
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9671
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10551
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6979
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5650
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4458
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4020
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.