Home > Net >  C # for the time and date
C # for the time and date

Time:10-08




//get the date + time
DateTime. Now. The ToString ();//the 2008-9-4 20:02:10
DateTime. Now. ToLocalTime (). The ToString ();//the 2008-9-4 20:12:12
//get date
DateTime. Now. ToLongDateString (). The ToString ();//on September 4, 2008,
DateTime. Now. ToShortDateString (). The ToString ();//the 2008-9-4
DateTime. Now. ToString (" yyyy - MM - dd ");//the 2008-09-04
DateTime. Now. The Date. The ToString ();//the 2008-9-4 0:00:00
//get time
DateTime. Now. ToLongTimeString (). The ToString ();//20:16:16
DateTime. Now. ToShortTimeString (). The ToString ();//"
DateTime. Now. ToString (hh: mm: ss ");//08:05:57
DateTime. Now. TimeOfDay. ToString ();//20:33:50. 7187500
//other
DateTime. ToFileTime (). The ToString ();//128650040212500000
DateTime. Now. ToFileTimeUtc (). The ToString ();//128650040772968750
DateTime. Now. ToOADate (). The ToString ();//39695.8461709606
DateTime. Now. ToUniversalTime (). The ToString ();//the 2008-9-4 12:19:14
DateTime. Now. The Year. The ToString (); Get/2008/year
DateTime. Now. The Month. The ToString (); Get in//9
DateTime. Now. DayOfWeek. ToString ();//for week Thursday
DateTime. Now. The DayOfYear. ToString (); For how many days//248
DateTime. Now. The Hour. The ToString (); For hours//20
DateTime. Now. Minute. ToString (); For 31 minutes//
DateTime. Now. Second, the ToString (); Get seconds//45
//n for a number of things can be integer number, fractional
Dt. AddYears (n). The ToString ();//time plus n years
Dt. AddDays (n). The ToString ();//add n day
Dt. AddHours (n). The ToString ();//add n hour
Dt. AddMonths (n). The ToString ();//add n months
Dt. AddSeconds (n). The ToString ();//add n SEC
Dt. AddMinutes (n). The ToString ();//add n points
SQL statements use a function of time and date
Getdate () : get the current system time
Dateadd (datepart, number, date) : calculated on the basis of a time increase the value of a new time after time, such as: dateadd (yy, 30, getdate ())
Datediff (datepart, startdate, enddate) : to calculate the difference between the two time, such as: datediff (yy, getdate (), '2008-08-08')
Dataname (datepart, date) : time for different parts of the value, the return value as a string
Datepart (datepart, date) : and datename similar, just return values for the integer
Day (date) : access to the specified time
The month (date) : obtain the specified time in
Year (date) : obtain the appointed time year
Select year (getdate ()) : the current year

CodePudding user response:

Excuse me how to get the lunar date and power calendar date?

CodePudding user response:

reference 1/f, started the first response:
could you tell me how to get the lunar date and power calendar date?

The thick stick to leverage

CodePudding user response:

CodePudding user response:

Record post

CodePudding user response:

reference 1/f, started the first response:
could you tell me how to get the lunar date and power calendar date?


This want to forget it,

The format of the 1 # will be affected by the environment in different language expression format,

CodePudding user response:

System. Globalization. ChineseLunisolarCalendar know about the

reference 1/f, started the first response:
could you tell me how to get the lunar date and power calendar date?

CodePudding user response:

How do I get the timestamp format

CodePudding user response:

reference 1/f, started the first response:
could you tell me how to get the lunar date and power calendar date?

Special correspondent

CodePudding user response:

Contact points

CodePudding user response:

Contact points

CodePudding user response:

Only for reference   , the content of the concrete thinking to yourself

CodePudding user response:

I thought to send points, the original is on show
  • Related