|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
||||
|
||||
|
DateTime - How do I set the year to year 2000?
I was wondering how do I set the year to year 2000?
Code:
System.DateTime oDateTime = new System.DateTime(); //.Year("2000"); //.Year(-100);
Thanks... |
|
#2
|
||||
|
||||
|
Do you want to set the system time of the current computer, do you want to use Jan 1 for the the month and day, or do you want to go back exactly 8 years?
__________________
Primary Forums: .Net Development, MS-SQL, C Programming VB.Net: It's not your father's Visual Basic. [Moving to ASP.Net] | [.Net Dos and Don't for VB6 Programmers] |
|
#3
|
||||
|
||||
|
I just want to set the oDateTime object to jan 1, 2000 or the Year() object to the oDateTime object to Year 2000 regardless of the day or month.
I have no desire to set the computer's (or PC's) system time to whatever date. |
|
#4
|
|||
|
|||
|
do you mean like this?
Code:
DateTime newDate = DateTime.Now.AddYears(-8); |
|
#5
|
||||
|
||||
|
Code:
C#
//2000-01-01 00:00:00 DateTime date = new DateTime(2000, 1, 1, 0, 0, 0); Code:
C#
//2000-??-?? ??:??:?? DateTime n = DateTime.Now; DateTime date = new DateTime(2000, n.Month, n.Day, n.Hour, n.Minute, n.Second); |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > DateTime - How do I set the year to year 2000? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|