Convert dd / MM / yyyy to yyyy / MM / dd

0

I have the following code:

Me.txtFechaFin.Text = '08/03/2018'

can someone tell me how I can convert it to

Me.txtFechaFin.Text = '2018/03/08'
    
asked by ARR 08.03.2018 в 23:50
source

2 answers

1

If I remember correctly, you can do it with the property Format .

Try something like this in your code:

Me.txtFechaFin.Text = Format(Me.txt.FechaFin.Text, "yyyy/mm/dd")
    
answered by 09.03.2018 / 01:00
source
1

Convert it to a DateTime object, and then go back to a text string, like this:

DateTime myDate = DateTime.ParseExact(Me.txtFechaFin.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
Me.txtFechaFin.Text =  myDate.ToString("yyyy/MM/dd", CultureInfo.InvariantCulture);
    
answered by 09.03.2018 в 08:16