datetimepicker won't let me use fractions of a second?

J

jleslie48

Using format: custom,

I try and enter: "yyyy-MM-dd HH:mm:ss ffff"

but no matter what I do, the display shows the letters ffff instead of
the 4 digits of the fractional part of the second and the input box
wont let me type on the ffff letters. Any ideas?


//
// dateTimePicker1
//
this.dateTimePicker1.AllowDrop = true;
this.dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm:ss
ffff";
this.dateTimePicker1.Format =
System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker1.Location = new
System.Drawing.Point(12,27);
this.dateTimePicker1.MaxDate = new
System.DateTime(2100,12,31,0,0,0,0);
this.dateTimePicker1.MinDate = new
System.DateTime(1990,1,1,0,0,0,0);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(202,20);
this.dateTimePicker1.TabIndex = 9;
this.dateTimePicker1.ValueChanged += new
System.EventHandler(this.dateTimePicker1_ValueChanged);
//
 
J

jleslie48

Using format:  custom,

I try and enter:  "yyyy-MM-dd HH:mm:ss ffff"

but no matter what I do, the display shows the letters ffff instead of
the 4 digits of the fractional part of the second and the input box
wont let me type on the ffff letters.  Any ideas?

//
        // dateTimePicker1
        //
        this.dateTimePicker1.AllowDrop = true;
        this.dateTimePicker1.CustomFormat = "yyyy-MM-dd  HH:mm:ss
ffff";
        this.dateTimePicker1.Format =
System.Windows.Forms.DateTimePickerFormat.Custom;
        this.dateTimePicker1.Location = new
System.Drawing.Point(12,27);
        this.dateTimePicker1.MaxDate = new
System.DateTime(2100,12,31,0,0,0,0);
        this.dateTimePicker1.MinDate = new
System.DateTime(1990,1,1,0,0,0,0);
        this.dateTimePicker1.Name = "dateTimePicker1";
        this.dateTimePicker1.Size = new System.Drawing.Size(202,20);
        this.dateTimePicker1.TabIndex = 9;
        this.dateTimePicker1.ValueChanged += new
System.EventHandler(this.dateTimePicker1_ValueChanged);
        //

for reference: I'm on Windows XP professional, with MS visual C#
2010 express
 
J

jleslie48

A

Arne Vajhøj

ok, this is the only article I can find on the subject:

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/0743e1a9-e7be-4b1a-8fa2-59855c1f450a

it says its an "undocumented MS feature" that datetimepicker in
fractions is broken...err, designed to not do fractions.
can anybody confirm or deny this?

I guess my best solution is to make up a new input box for the
fraction part?

When I look at the docs at:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.customformat.aspx
then it list the supported format strings and f is
not among them, so I would say that the code behaves
as it is documented to behave.

Arne
 
J

Jeff Johnson

it says its an "undocumented MS feature" that datetimepicker in
fractions is broken...err, designed to not do fractions.
can anybody confirm or deny this?

I have to ask: when would you expect an average user to enter fractions of a
second? In other words, I think MS designed the date/time picker with the
80/20 rule in mind (although this sounds more like the 99/1 rule) and didn't
allow for what they considered to be a fringe case.
 
J

jleslie48

I have to ask: when would you expect an average user to enter fractions of a
second? In other words, I think MS designed the date/time picker with the
80/20 rule in mind (although this sounds more like the 99/1 rule) and didn't
allow for what they considered to be a fringe case.

Well I dump data from an oscilliscope into csv files and things are
measured in nanoseconds. I'm not the only one, and more to the point,
when you implement a standard, such as hh:mm:ss.ffffffff it it too
much to ask to actually program it????
 
A

Arne Vajhøj

Well I dump data from an oscilliscope into csv files and things are
measured in nanoseconds. I'm not the only one, and more to the point,
when you implement a standard, such as hh:mm:ss.ffffffff it it too
much to ask to actually program it????

But it did not implement such a standard.

The documentation is very clear - it does not support f.

The code works as the documentation says it work.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top