1.

Solve : date formatting in VB?

Answer»

how can I change a text box value to a date format and save in the backend...
hw can i retrietve and again do the additions, SUBTRACTIONS etcNot really understanding the question. Could you give an example of a text box value you want to convert to a date. Is the backend a database?



I am doing a project for my own office for "PREPAID HOTEL VOUCHER "

i am not a software professional...i havnt done any project in VB before.
i have only basic knowledge in computer.

Data are like " hotel name, address, passenger name, checkin(date), chkout( date), issuedate ...

now i am using dataenvironment as a connection ...this information i got from internet help details...it is good ...now i can save the data to the table...

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.

I have to WRITE a " search" command also
input values are "startdate" and "enddate"
i have to display all the records of which the "issuedate" value is between the above dates.




Quote

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
input values are "startdate" and "enddate"
i have to display all the records of which the "issuedate" value is between the above dates.

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

THEN I PUT 29/02/2009

FOR THIS ALSO THE SAME REPLY

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.


Discussion

No Comment Found