Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change "ddd" datetime format to a number view

Tags:

c#

I want to make that code to show me a current datetime on my pc clock when i click a button... i did it with that code listed down. But here is my question how can i make the "ddd" (day of a week) to be shown in number, not in words, I mean: 00-sunday 01-monday and etc. ...

This is my code for the button:

private void SetClock_Click(object sender, EventArgs e)
        {
            SetClock.Click += new EventHandler(SetClock_Click);
            {
                DateTime time = DateTime.Now;
                string format = "yy-MM-dd-ddd-hh-mm-ss"; 
                txtSend.Text = time.ToString(format);

            }
        }

What i have to add to make it. Thanks

like image 556
Nikola Obretenov Avatar asked Oct 25 '12 12:10

Nikola Obretenov


1 Answers

txtSend.Text = string.Format("{0:yy-MM-dd}-{1:00}-{0:hh-mm-ss}", time, (int)time.DayOfWeek);
like image 158
Cole Cameron Avatar answered Sep 19 '22 17:09

Cole Cameron