InterviewSolution
| 1. |
Solve : date formatting in VB? |
|
Answer» how can I change a text box value to a date format and save in the backend... when i am saving text value "30/12/2008" , in the table it is saved as "12/30/2008"...first record is ok...from the second record this problem starts This a new one on me. Which is correct? If your regional settings call for mm/dd/yyyy, it's better to flag dd/mm/yyyy an error at the textbox source. You can use the isDate function to determine a date's validity. This example will blurb that 02/29/2009 is not a date: Code: [Select]str = "02/29/2009" If IsDate(str) Then msgbox(str & " is date") Else msgbox(str & " not date") End If Note: isDate uses your regional settings to makes it's determination Quote I have to write a " search" command also This WOULD involve a query against the table: Code: [Select]select * from table where issuedate BETWEEN startdate AND enddate The above SQL statement is inclusive with the start and end dates. Good luck. THNAK YOU VERY MUCH FOR YOUR IMMED REPLY " 02/29/2008 IS NOT DATE " IS THE REPLY I GOT THEN I PUT 29/02/2009 FOR THIS ALSO THE SAME REPLY Quote " 02/29/2008 IS NOT DATE " IS THE REPLY I GOT To be expected. Feb 29, 2009 is not a valid date in any format. Better to have checked 12/30/2008 and 30/12/2008. The point is to get the same date format in the textbox as you stow in the database. There was no question in your previous reply. Is everything good now? Good luck. |
|