Format(Date, "MM/DD/YYYY")

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sabina
    New Member
    • Oct 2006
    • 16

    Format(Date, "MM/DD/YYYY")

    Hello,

    How can I porting this code

    to_date('" & Format(Date, "MM/DD/YYYY") & "','mm/dd/yyyy')

    from VB to aspx?

    SelectCommand=" SELECT * FROM tbl_Products
    WHERE tbl_Products.Pr oductStartDate <= to_date('" & Format(Date, "MM/DD/YYYY") & "','mm/dd/yyyy')"

    Thanks,Sabina
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Format(Date, "MM/DD/YYYY")

    Comment

    • Sabina
      New Member
      • Oct 2006
      • 16

      #3
      Hello,

      I don't undestand.
      I can't replace

      to_date('" & Format(Date, "MM/DD/YYYY") & "','mm/dd/yyyy') (from VB) to
      Format(Date, "MM/DD/YYYY")

      How can I port to_date('" & Format(Date, "MM/DD/YYYY") & "','mm/dd/yyyy') from VB to asp.net?




      Thanks,Sabina

      Comment

      • digitalmanic
        New Member
        • Oct 2006
        • 24

        #4
        Sabina,

        The below link explains all date formating. Check it.





        Ambika Praveen.

        Comment

        • Sabina
          New Member
          • Oct 2006
          • 16

          #5
          I get the error message :"Cannot switch views:(validati on (asp.net):If this attribute value is enclosed in quotation marks,the quotation marks must match.


          SelectCommand=" SELECT Product_Code, Product_ID FROM tbl_Employees,t bl_Factories,tb l_Product_categ ories,tbl_Produ cts
          WHERE tbl_Factories.F actory_ID = tbl_Product_cat egories.Factory _ID
          AND tbl_Product_cat egories.Product _category_ID = tbl_Products.Pr oduct_category_ ID
          AND tbl_Employees.E mployee_ID = tbl_Product_cat egories.Product _category_Manag er_ID
          AND tbl_Products.Pr oductStartDate <= to_date('" & Format(Date, "MM/DD/YYYY") & "','mm/dd/yyyy')"

          If I close SelectCommand
          SelectCommand=" SELECT Product_Code, Product_ID FROM tbl_Employees,t bl_Factories,tb l_Product_categ ories,tbl_Produ cts
          WHERE tbl_Factories.F actory_ID = tbl_Product_cat egories.Factory _ID
          AND tbl_Product_cat egories.Product _category_ID = tbl_Products.Pr oduct_category_ ID
          AND tbl_Employees.E mployee_ID = tbl_Product_cat egories.Product _category_Manag er_ID"

          without the last line I getn't the errors.


          Thanks,Sabina

          Comment

          • Sabina
            New Member
            • Oct 2006
            • 16

            #6
            Hello,

            How can I port >= ?


            Thanks,Sabina

            Comment

            • kenobewan
              Recognized Expert Specialist
              • Dec 2006
              • 4871

              #7
              I suggest placing the datetime in a variable first, formatting the date and then using it in your select statement. You have already debugged and established the problem, now take this further. Display the variable if it is still not working to see why it might not work...

              Comment

              Working...