C# Class Rock.RockDateTime

Special Class that returns current Current DateTime based on the TimeZone set in Web.Config This is done because the system may be hosted in a different timezone than the organization Rock developers should use RockDateTime.Now instead of DateTime.Now
Mostra file Open project: NewSpring/Rock Class Usage Examples

Public Methods

Method Description
ConvertLocalDateTimeToRockDateTime ( System.DateTime localDateTime ) : System.DateTime

Converts the local date time to rock date time. Use this to convert a local datetime (for example, the datetime of a file stored on the server) to the Rock OrgTimeZone

New ( int year, int month, int day ) : DateTime?

Creates a new datetime based on year, month, day, and handles 2/29 for non leap years (returns 2/28 in this case)

Method Details

ConvertLocalDateTimeToRockDateTime() public static method

Converts the local date time to rock date time. Use this to convert a local datetime (for example, the datetime of a file stored on the server) to the Rock OrgTimeZone
public static ConvertLocalDateTimeToRockDateTime ( System.DateTime localDateTime ) : System.DateTime
localDateTime System.DateTime The local date time.
return System.DateTime

New() public static method

Creates a new datetime based on year, month, day, and handles 2/29 for non leap years (returns 2/28 in this case)
public static New ( int year, int month, int day ) : DateTime?
year int The year.
month int The month.
day int The day.
return DateTime?