Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Comment convertir une date sous format 'dd-mm-y' en date 'y-mm-dd' en vb.net 2008,sans convertir la date en chaîne de caractère?

comment convertir une date sous format 'dd-mm-y' en date sous format 'y-mm-dd' dans une application en vb.net2008,et le type date de la date reste le même(date) sans convertir la date en chaîne de caractère(string)

user-image
Question added by Deleted user
Date Posted: 2014/01/02
Deleted user
by Deleted user

merci beaucoup pour me repondre,Apparemment, vous etes experimenté  dans votre domaine

mais je vous annonce que j'ai deja trouvé la solution 

j'ai posé la qustion parceque je pensais que le vb ne compare pas entre deux date1ere sous format 'yyyy-mm-dd' celui de la base de donne de sql server et la2eme date sous format 'dd-mm-yyyy' de vb de control(DateTimePicker1.Value) c'set pour cele je cherchai une solution pour faire la comparaison sans convertie la date de vb une chaine de caractere,

mais j'ai lhamdo lilah trouvé une solution tres simple et utile

Hatim Laxmidhar
by Hatim Laxmidhar , Self Employed , The Way It Works

Interesting question.

To answer your question, let me explain what a Date object actually has inside.

In VB.net, a Date object does not store a date as date (i.e. date, month, year, hour, minutes or seconds). It stores ticks (100-nanosecond units) in IEEE64-bit (8-byte) values, and a particular date is the number of ticks since12:00 midnight, January1,0001.

For example, a ticks value of0L represents the date, Friday, January01,010012:00:00 midnight. A DateTime value is always expressed in the context of an explicit or default calendar. Formatting is the process of converting a value to its string representation.

In short, what you see in your output is nothing but string. When your print date, it automatically converts the date to default format as per your locale. 

You can use Format function.

Format (dateobject as object, dateformat as string) as string.

Sources:

To read more about Date data type visit:

http://msdn.microsoft.com/en-us/library/3eaydw6e(v=vs.90).aspx

 To read more about Format visit:

http://msdn.microsoft.com/en-us/library/59bz1f0h(v=vs.90).aspx

 

More Questions Like This