using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace GetDayOfWeek
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DateTime dt = dateTimePicker1.Value;
textBox1.Text = dt.ToString("dddd");
}
}
}
DateTime dt = dateTimePicker1.Value;
にて、DateTimePickerで選択している日時をDateTime型で取り出します。textBox1.Text = dt.ToString("dddd");
DateTimeのToString()メソッドを用いて書式を指定して文字列にします。書式指定に"dddd"を指定すると、システムに登録されている曜日名を出力できます。