Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: date formatting in VB  (Read 4623 times)

0 Members and 1 Guest are viewing this topic.

SURESH2008

    Topic Starter


    Starter

    date formatting in VB
    « on: June 08, 2008, 09:19:43 AM »
    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 etc

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: date formatting in VB
    « Reply #1 on: June 09, 2008, 05:24:42 AM »
    Not 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?

     8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    SURESH2008

      Topic Starter


      Starter

      Re: date formatting in VB
      « Reply #2 on: June 09, 2008, 07:17:58 AM »


      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.


       


      Sidewinder



        Guru

        Thanked: 139
      • Experience: Familiar
      • OS: Windows 10
      Re: date formatting in VB
      « Reply #3 on: June 09, 2008, 07:56:14 AM »
      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. 8)
      « Last Edit: June 09, 2008, 08:16:40 AM by Sidewinder »
      The true sign of intelligence is not knowledge but imagination.

      -- Albert Einstein

      SURESH2008

        Topic Starter


        Starter

        Re: date formatting in VB
        « Reply #4 on: June 09, 2008, 09:07:22 AM »
        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

        Sidewinder



          Guru

          Thanked: 139
        • Experience: Familiar
        • OS: Windows 10
        Re: date formatting in VB
        « Reply #5 on: June 09, 2008, 09:28:13 AM »
        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. 8)
        The true sign of intelligence is not knowledge but imagination.

        -- Albert Einstein