Date Format

  • Thread starter Thread starter Barbara Papapetrou
  • Start date Start date
B

Barbara Papapetrou

I always get 12:00:00 time next to the date in my VB.NET Windows form
application. How can I get only the date to appear?

Panos Adam
 
Barbara Papapetrou said:
I always get 12:00:00 time next to the date in my VB.NET Windows
form application. How can I get only the date to appear?

Use a different format string, like "MM\.dd\.yyyy"

dim d as date

msgbox d.tostring("MM\.dd\.yyyy")
 
Barbara Papapetrou said:
I always get 12:00:00 time next to the date in my VB.NET Windows form
application. How can I get only the date to appear?

Several ways...

lblCurrDay.Text = dtpDatePick.Value.ToString("dd/MM/yyyy")

.... (the dtpDatePick is a DateTimePicker)

or

newDate = FormatDateTime(lblCurrDay.Text, DateFormat.ShortDate)

The DateFormat gives you a few options... the first one some other custom
options... Check up on them.

Regards,

Bruce
 
* "Barbara Papapetrou said:
I always get 12:00:00 time next to the date in my VB.NET Windows form
application. How can I get only the date to appear?

There are many different ways depending on the format you want to be
displayed. For example 'MsgBox(d.ToShortDateString())' or the date's
'ToString' method with the appropriate format string...
 
You could also use the Format() function from the Strings class in the
Microsoft.VisualBasic namespace. You can format your date anyway you want.

LB.
 
Back
Top