i need to convert date format used from datetimepicker as(dd/mm/yyyy) to (yyyy-mm-dd) any ideas
thanks

Dim strdate As String
        strdate$ = VB6.Format$(Now(), "YYYY-MM-DD")
msgbox(strdate$)

another way

now()function cant be used. im reading 2 variable dates from datepickers....
iv allready solved aneway,, i created a function to read the date as string, break it in to charecters and then re-arrenge it the way i want
thankss

Did you try ToString()? DateTimePicker1.Value.ToString("yyyy-MM-dd") should have worked.

Dim strdate As String
        strdate$ = VB6.Format$(Now(), "YYYY-MM-DD")
msgbox(strdate$)

another way

I am trying to Format my date
but i am getting error;;

Dim mydate As Date = Format(cmbScheduleDate.Text, "MM/dd/yyyy")

cmbScheduleDate.Text Value is 05/30/2007 10:00 AM

I am getting error :Conversion from string "MM/dd/yyyy" to type 'Date' is not valid

even i tried taking value in to string insted of date
like Dim mydate As String = Format(cmbScheduleDate.Text, "MM/dd/yyyy")

if i write this line i am getting mydate value is "MM/dd/yyyy"

make sure you do

dim mydate as string

mydate$ = VB6.format$(cmbscheduledate.text, "YYYY-MM-DD")

i have this error.. when i save the value of datetimepicker to sql database it will just save like this 0000-00-00.. and im having error when i select the value in the database cause its null. can you guys help me with my prob?
here's my code

Dim strinsertMember As String
        If txtFname.Text = "" Or txtLname.Text = "" Or txtAge.Text = "" Or txtAddress.Text = "" Or txtPhone.Text = "" Or cboMinistry.Text = "" Then

            MsgBox("Required fields are empty", MsgBoxStyle.Exclamation)
        Else
            strinsertMember = "INSERT INTO tbl_members" & "(Fname,Lname,Age,Birthday,Address,Phone,Ministry)" & " VALUES('" & txtFname.Text.ToUpper & "','" & txtLname.Text.ToUpper & "','" & txtAge.Text.ToUpper & "','" & Format$(DateTimePicker1.Value.ToString, "YYYY-mm-dd") & "','" & txtAddress.Text & " ','" & txtPhone.Text & "','" & cboMinistry.Text & "')"
            CLSCONN = New DBConnect
            CLSCONN.ACCESS_INDREC(strinsertMember)
            MsgBox("Data has been save", MsgBoxStyle.Information)



        End If

remove the -'s from your to string function
let me know if that works if not ill look at it some more

i don't have alot of time right now to look at it (at work)

i normally use the vb6 format feature
i just add the vb comptatibility reference
then i do the following

vb6.format$(now, "YYYYMMDD")

has never given me a problem

i see from looking at your code that you are using the format$ (just got time to check it out)

FORMAT$(datetimepicker.value, "YYYYMMDD") should work without a problem i do it alot

This question has already been answered. Start a new discussion instead.