locked
DatePicker custom format for MySQL

    Question

  • Hi, I guess this was asked often but I´m searching since 4 hours and I can´t find any recent Topic.

    So how can I change the Format of a DatePicker in VS 2013 for a Windows App in Visual Basic ?

    I need to send a date in the MySQL "DATE" format.

    Thank you in advance!

    Tuesday, April 15, 2014 8:01 PM

Answers

  • What format does MySQL expect?

    You can extract the date from the DatePicker's Date property and can convert it with the DateTimeOffset's ToString method.

    Tuesday, April 15, 2014 11:52 PM
    Owner
  • Update

    I just found an easy way, I just need to add "Date.ToString("yyyy-MM-dd")" behind a DatePicker in my code.

    DatePicker.Date.ToString("yyyy-MM-dd")

    Wednesday, April 16, 2014 9:59 AM

All replies

  • What format does MySQL expect?

    You can extract the date from the DatePicker's Date property and can convert it with the DateTimeOffset's ToString method.

    Tuesday, April 15, 2014 11:52 PM
    Owner
  • MySQL use "yyyy-MM-dd" as format for  DATE,  I´m trying with DateTimeOffset but I can´t get it to use my format.

    At the moment if I take a Date from the DatePicker (16.05.2014)

    In my Database it become (2016-05-20)

    • Edited by Uriziel Wednesday, April 16, 2014 9:49 AM
    Wednesday, April 16, 2014 9:36 AM
  • Update

    I just found an easy way, I just need to add "Date.ToString("yyyy-MM-dd")" behind a DatePicker in my code.

    DatePicker.Date.ToString("yyyy-MM-dd")

    Wednesday, April 16, 2014 9:59 AM