Amit Kumar
Amit Kumar

Reputation: 1059

How can i set first day of first month of current year in datetimepicker

How can I set first day of first month of current year in DateTimePicker.

eg. I want to show this time format in DateTimePicker:

01/01/2013

Upvotes: 1

Views: 9329

Answers (3)

Ehsan
Ehsan

Reputation: 32661

Set it like this

picker.Value = new DateTime(DateTime.Now.Year, 1, 1);

Upvotes: 0

TTT
TTT

Reputation: 1885

this.dateTimePicker1.Value = new DateTime(DateTime.Now.Year, 1, 1);

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1499740

Can't you just use:

picker.Value = new DateTime(picker.Value.Year, 1, 1);

? If that doesn't work, please give more context.

Upvotes: 8

Related Questions