Как я могу преобразовать галочки в формат даты?

/**
 * Returns true if the specified string contains "*/".
 */

Это - ‘right’ решение, но для пользы удобочитаемости я, вероятно, пошел бы для:

/**
 * Returns true if the string contains an asterisk followed by slash.
 */
62
задан marc_s 31 December 2009 в 13:38
поделиться

3 ответа

A DateTime object can be constructed with a specific value of ticks. Once you have determined the ticks value, you can do the following:

DateTime myDate = new DateTime(numberOfTicks);
String test = myDate.ToString("MMMM dd, yyyy");
177
ответ дан 24 November 2019 в 16:30
поделиться
    private void button1_Click(object sender, EventArgs e)
    {
        long myTicks = 633896886277130000;
        DateTime dtime = new DateTime(myTicks);
        MessageBox.Show(dtime.ToString("MMMM d, yyyy"));
    }

Gives

September 27, 2009

Is that what you need?

I don't see how that format is necessarily easy to work with in SQL queries, though.

5
ответ дан 24 November 2019 в 16:30
поделиться

It's much simpler to do this:

DateTime dt = new DateTime(633896886277130000);

Which gives

dt.ToString() ==> "9/27/2009 10:50:27 PM"

You can format this any way you want by using dt.ToString(MyFormat). Refer to this reference for format strings. "MMMM dd, yyyy" works for what you specified in the question.

Not sure where you get October 1.

49
ответ дан 24 November 2019 в 16:30
поделиться
Другие вопросы по тегам:

Похожие вопросы: