windows - Changing date-time format in c# -


creating digital clock. i'm newbie c#. code that

    timelbl.text = datetime.now.tolongtimestring();     datelbl.text = datetime.now.tolongdatestring(); 

here is, result

http://content.screencast.com/users/tt13/folders/jing/media/da6d1f65-bf5f-4735-97dc-70485112a998/2012-07-02_1826.png

i got questions:

  1. can change time's format 24 hour? how?
  2. how change date digits format (like dd/mm/yyyy) or result in exact language (i mean, words "monday, july" in language, windows support, ex turkish)?
  3. how make window dynamically change it's width (depending on text length)?

please me,to achieve these 3 things. thx in advance

ans 1:

timelbl.text = datetime.now.tostring("hh:mm:ss"); 

will convert time 24 hour format.

ans 2:

datelbl.text = datetime.now.tostring("dd/mm/yyyy"); 

will convert date format 31/06/2012

more formats here


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -