C# Класс Pchp.Library.DateTimeFunctions

Показать файл Открыть проект

Открытые методы

Метод Описание
checkdate ( int month, int day, int year ) : bool

Returns TRUE if the date given is valid; otherwise returns FALSE. Checks the validity of the date formed by the arguments.

A date is considered valid if: year is between 1 and 32767 inclusive month is between 1 and 12 inclusive day is within the allowed number of days for the given month. Leap years are taken into consideration.

date ( Context ctx, string format ) : string

Returns a string formatted according to the given format string using the current local time.

date ( Context ctx, string format, int timestamp ) : string

Returns a string formatted according to the given format string using the given integer timestamp.

date_sunrise ( Context ctx, int timestamp ) : PhpValue
date_sunrise ( Context ctx, int timestamp, TimeFormats format ) : PhpValue
date_sunrise ( Context ctx, int timestamp, TimeFormats format, double latitude ) : PhpValue
date_sunrise ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude ) : PhpValue
date_sunrise ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith ) : PhpValue
date_sunrise ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith, double offset ) : PhpValue
date_sunset ( Context ctx, int timestamp ) : PhpValue
date_sunset ( Context ctx, int timestamp, TimeFormats format ) : PhpValue
date_sunset ( Context ctx, int timestamp, TimeFormats format, double latitude ) : PhpValue
date_sunset ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude ) : PhpValue
date_sunset ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith ) : PhpValue
date_sunset ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith, double offset ) : PhpValue
getdate ( Context ctx ) : PhpArray

Returns an associative array containing the date information of the current local time.

getdate ( Context ctx, int timestamp ) : PhpArray

Returns an associative array containing the date information of the timestamp.

gettimeofday ( Context ctx ) : PhpArray

Gets time information.

It returns PhpArray containing the following 4 entries: "sec"Unix timestamp (seconds since the Unix Epoch) "usec"microseconds "minuteswest"minutes west of Greenwich (doesn't take daylight savings time in consideration) "dsttime"type of DST correction (+1 or 0, determined only by the current time zone not by the time)

gettimeofday ( Context ctx, bool returnDouble ) : object
gmdate ( string format ) : string

Identical to the date() function except that the time returned is Greenwich Mean Time (GMT)

gmdate ( string format, int timestamp ) : string

Identical to the date() function except that the time returned is Greenwich Mean Time (GMT)

idate ( Context ctx, string format ) : int

Returns a part of current time.

idate ( Context ctx, string format, int timestamp ) : int

Returns a part of a specified timestamp.

localtime ( Context ctx ) : PhpArray

The localtime() function returns an array identical to that of the structure returned by the C function call. Current time is used, regular numericaly indexed array is returned.

localtime ( Context ctx, int timestamp ) : PhpArray

The localtime() function returns an array identical to that of the structure returned by the C function call. Time specified by the parameter timestamp is used, regular numericaly indexed array is returned.

localtime ( Context ctx, int timestamp, bool returnAssociative ) : PhpArray

The localtime() function returns an array identical to that of the structure returned by the C function call. The first argument to localtime() is the timestamp. The second argument to the localtime() is the isAssociative, if this is set to false than the array is returned as a regular, numerically indexed array. If the argument is set to true then localtime() is an associative array containing all the different elements of the structure returned by the C function call to localtime.

Returned array contains these elements if isAssociative is set to true: "tm_sec"seconds "tm_min"minutes "tm_hour"hour "tm_mday"day of the month "tm_mon"month of the year, starting with 0 for January "tm_year"Years since 1900 "tm_wday"Day of the week "tm_yday"Day of the year "tm_isdst"Is daylight savings time in effect

microtime ( bool returnDouble ) : PhpValue

Returns the fractional time in seconds from the start of the UNIX epoch.

microtime ( ) : string

Returns the string "msec sec" where sec is the current time measured in the number of seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and msec is the microseconds part.

strtotime ( string time ) : int

Parses a string containing an English date format into a UNIX timestamp relative to the current time.

strtotime ( string time, int start ) : int

Parses a string containing an English date format into a UNIX timestamp relative to a specified time.

time ( ) : int

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

Приватные методы

Метод Описание
CalculateSunTime ( int day, double latitude, double longitude, double zenith, bool getSunrise ) : double

Calculates sunrise or sunset. Adopted PHP implementation by Moshe Doron ([email protected]). Returns UTC time.

FormatDate ( string format, System.DateTime utc, TimeZoneInfo zone ) : string
GetDate ( Context ctx, System.DateTime utc ) : PhpArray

Returns an associative array containing the date information.

GetDatePart ( char format, System.DateTime utc, TimeZoneInfo zone ) : int
GetDayNumberSuffix ( int DayNumber ) : string

English ordinal suffix for the day of the month, 2 characters - st, nd, rd or th.

GetIsoWeekAndYear ( System.DateTime dt, int &week, int &year ) : void

Converts a given DateTime to the ISO week of year number and ISO year number.

GetLocalTime ( TimeZoneInfo currentTz, System.DateTime utc, bool returnAssociative ) : PhpArray
GetNow ( Context ctx ) : System.DateTime

Gets the current local time with respect to the current PHP time zone.

GetSunTime ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith, double offset, bool getSunrise ) : PhpValue
GetSwatchBeat ( System.DateTime utc ) : int
GetTimeOfDay ( System.DateTime utc, TimeZoneInfo zone ) : PhpArray
MakeDateTime ( int hour, int minute, int second, int month, int day, int year ) : System.DateTime
StringToTime ( string time, System.DateTime startUtc ) : int

Implementation of StringToTime(string,int) function.

ToDegrees ( double radians ) : double
ToRadians ( double degrees ) : double

Описание методов

checkdate() публичный статический Метод

Returns TRUE if the date given is valid; otherwise returns FALSE. Checks the validity of the date formed by the arguments.
A date is considered valid if: year is between 1 and 32767 inclusive month is between 1 and 12 inclusive day is within the allowed number of days for the given month. Leap years are taken into consideration.
public static checkdate ( int month, int day, int year ) : bool
month int Month
day int Day
year int Year
Результат bool

date() публичный статический Метод

Returns a string formatted according to the given format string using the current local time.
public static date ( Context ctx, string format ) : string
ctx Pchp.Core.Context Current runtime context.
format string Format definition for output.
Результат string

date() публичный статический Метод

Returns a string formatted according to the given format string using the given integer timestamp.
public static date ( Context ctx, string format, int timestamp ) : string
ctx Pchp.Core.Context Current runtime context.
format string Format definition for output.
timestamp int Nuber of seconds since 1970 specifying a date.
Результат string

date_sunrise() публичный статический Метод

public static date_sunrise ( Context ctx, int timestamp ) : PhpValue
ctx Pchp.Core.Context
timestamp int
Результат Pchp.Core.PhpValue

date_sunrise() публичный статический Метод

public static date_sunrise ( Context ctx, int timestamp, TimeFormats format ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
Результат Pchp.Core.PhpValue

date_sunrise() публичный статический Метод

public static date_sunrise ( Context ctx, int timestamp, TimeFormats format, double latitude ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
latitude double
Результат Pchp.Core.PhpValue

date_sunrise() публичный статический Метод

public static date_sunrise ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
latitude double
longitude double
Результат Pchp.Core.PhpValue

date_sunrise() публичный статический Метод

public static date_sunrise ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
latitude double
longitude double
zenith double
Результат Pchp.Core.PhpValue

date_sunrise() публичный статический Метод

public static date_sunrise ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith, double offset ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
latitude double
longitude double
zenith double
offset double
Результат Pchp.Core.PhpValue

date_sunset() публичный статический Метод

public static date_sunset ( Context ctx, int timestamp ) : PhpValue
ctx Pchp.Core.Context
timestamp int
Результат Pchp.Core.PhpValue

date_sunset() публичный статический Метод

public static date_sunset ( Context ctx, int timestamp, TimeFormats format ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
Результат Pchp.Core.PhpValue

date_sunset() публичный статический Метод

public static date_sunset ( Context ctx, int timestamp, TimeFormats format, double latitude ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
latitude double
Результат Pchp.Core.PhpValue

date_sunset() публичный статический Метод

public static date_sunset ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
latitude double
longitude double
Результат Pchp.Core.PhpValue

date_sunset() публичный статический Метод

public static date_sunset ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
latitude double
longitude double
zenith double
Результат Pchp.Core.PhpValue

date_sunset() публичный статический Метод

public static date_sunset ( Context ctx, int timestamp, TimeFormats format, double latitude, double longitude, double zenith, double offset ) : PhpValue
ctx Pchp.Core.Context
timestamp int
format TimeFormats
latitude double
longitude double
zenith double
offset double
Результат Pchp.Core.PhpValue

getdate() публичный статический Метод

Returns an associative array containing the date information of the current local time.
public static getdate ( Context ctx ) : PhpArray
ctx Pchp.Core.Context
Результат Pchp.Core.PhpArray

getdate() публичный статический Метод

Returns an associative array containing the date information of the timestamp.
public static getdate ( Context ctx, int timestamp ) : PhpArray
ctx Pchp.Core.Context Current runtime context.
timestamp int Number of seconds since 1970.
Результат Pchp.Core.PhpArray

gettimeofday() публичный статический Метод

Gets time information.
It returns PhpArray containing the following 4 entries: "sec"Unix timestamp (seconds since the Unix Epoch) "usec"microseconds "minuteswest"minutes west of Greenwich (doesn't take daylight savings time in consideration) "dsttime"type of DST correction (+1 or 0, determined only by the current time zone not by the time)
public static gettimeofday ( Context ctx ) : PhpArray
ctx Pchp.Core.Context
Результат Pchp.Core.PhpArray

gettimeofday() публичный статический Метод

public static gettimeofday ( Context ctx, bool returnDouble ) : object
ctx Pchp.Core.Context
returnDouble bool
Результат object

gmdate() публичный статический Метод

Identical to the date() function except that the time returned is Greenwich Mean Time (GMT)
public static gmdate ( string format ) : string
format string Format definition for output.
Результат string

gmdate() публичный статический Метод

Identical to the date() function except that the time returned is Greenwich Mean Time (GMT)
public static gmdate ( string format, int timestamp ) : string
format string Format definition for output.
timestamp int Nuber of seconds since 1970 specifying a date.
Результат string

idate() публичный статический Метод

Returns a part of current time.
public static idate ( Context ctx, string format ) : int
ctx Pchp.Core.Context Current runtime context.
format string Format definition for output.
Результат int

idate() публичный статический Метод

Returns a part of a specified timestamp.
public static idate ( Context ctx, string format, int timestamp ) : int
ctx Pchp.Core.Context Current runtime context.
format string Format definition for output.
timestamp int Nuber of seconds since 1970 specifying a date.
Результат int

localtime() публичный статический Метод

The localtime() function returns an array identical to that of the structure returned by the C function call. Current time is used, regular numericaly indexed array is returned.
public static localtime ( Context ctx ) : PhpArray
ctx Pchp.Core.Context
Результат Pchp.Core.PhpArray

localtime() публичный статический Метод

The localtime() function returns an array identical to that of the structure returned by the C function call. Time specified by the parameter timestamp is used, regular numericaly indexed array is returned.
public static localtime ( Context ctx, int timestamp ) : PhpArray
ctx Pchp.Core.Context Current runtime context.
timestamp int Number of seconds since 1970.
Результат Pchp.Core.PhpArray

localtime() публичный статический Метод

The localtime() function returns an array identical to that of the structure returned by the C function call. The first argument to localtime() is the timestamp. The second argument to the localtime() is the isAssociative, if this is set to false than the array is returned as a regular, numerically indexed array. If the argument is set to true then localtime() is an associative array containing all the different elements of the structure returned by the C function call to localtime.
Returned array contains these elements if isAssociative is set to true: "tm_sec"seconds "tm_min"minutes "tm_hour"hour "tm_mday"day of the month "tm_mon"month of the year, starting with 0 for January "tm_year"Years since 1900 "tm_wday"Day of the week "tm_yday"Day of the year "tm_isdst"Is daylight savings time in effect
public static localtime ( Context ctx, int timestamp, bool returnAssociative ) : PhpArray
ctx Pchp.Core.Context Current runtime context.
timestamp int
returnAssociative bool
Результат Pchp.Core.PhpArray

microtime() публичный статический Метод

Returns the fractional time in seconds from the start of the UNIX epoch.
public static microtime ( bool returnDouble ) : PhpValue
returnDouble bool true to return the double, false to return string.
Результат Pchp.Core.PhpValue

microtime() публичный статический Метод

Returns the string "msec sec" where sec is the current time measured in the number of seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and msec is the microseconds part.
public static microtime ( ) : string
Результат string

strtotime() публичный статический Метод

Parses a string containing an English date format into a UNIX timestamp relative to the current time.
public static strtotime ( string time ) : int
time string String containing time definition
Результат int

strtotime() публичный статический Метод

Parses a string containing an English date format into a UNIX timestamp relative to a specified time.
public static strtotime ( string time, int start ) : int
time string String containing time definition.
start int Timestamp (seconds from 1970) to which is the new timestamp counted.
Результат int

time() публичный статический Метод

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
public static time ( ) : int
Результат int