tp TouchPointWP Utilities DateFormats - TenthPres/TouchPoint-WP GitHub Wiki

tp\TouchPointWP\Utilities\DateFormats

Formatting Dates

  • Class name: DateFormats
  • Namespace: \tp\TouchPointWP\Utilities
  • This is an abstract class

Methods

TimeStringFormatted

string tp\TouchPointWP\Utilities\DateFormats::TimeStringFormatted(\DateTimeInterface dt)

Get a string for a single given DateTime.

  • Visibility: public
  • This method is static.

Arguments

  • dt DateTimeInterface

Returns

  • string -

timestampWithoutOffset

int tp\TouchPointWP\Utilities\DateFormats::timestampWithoutOffset(?\DateTimeInterface dt)
  • Visibility: public
  • This method is static.

Arguments

  • dt ?\DateTimeInterface

Returns

  • int -

timestampAndOffset

int tp\TouchPointWP\Utilities\DateFormats::timestampAndOffset(?\DateTimeInterface dt)
  • Visibility: public
  • This method is static.

Arguments

  • dt ?\DateTimeInterface

Returns

  • int -

TimeRangeStringFormatted

string tp\TouchPointWP\Utilities\DateFormats::TimeRangeStringFormatted(\DateTimeInterface startDt, \DateTimeInterface endDt)

Get a time string for a given pair of DateTimesInterfaces. This should generally only be used when all of these are true:

  • The DateTimes are on the same day.

  • The event represented is not all-day.

  • Neither are null

  • Visibility: public
  • This method is static.

Arguments

  • startDt DateTimeInterface* endDt DateTimeInterface

Returns

  • string -

DateStringFormatted

string tp\TouchPointWP\Utilities\DateFormats::DateStringFormatted(\DateTimeInterface dt)

Get a string for a single given datetime string.

  • Visibility: public
  • This method is static.

Arguments

  • dt DateTimeInterface

Returns

  • string -

DateStringFormattedShort

string tp\TouchPointWP\Utilities\DateFormats::DateStringFormattedShort(\DateTimeInterface dt)

Get a (shorter) string for a single given datetime string.

  • Visibility: public
  • This method is static.

Arguments

  • dt DateTimeInterface

Returns

  • string -

DurationToString

?string tp\TouchPointWP\Utilities\DateFormats::DurationToString(?\tp\TouchPointWP\Utilities\DateTimeExtended start, ?\tp\TouchPointWP\Utilities\DateTimeExtended end, bool|null multiDay)

Get a string for the period between $start and $end.

  • Visibility: public
  • This method is static.

Arguments

  • start ?\tp\TouchPointWP\Utilities\DateTimeExtended* end ?\tp\TouchPointWP\Utilities\DateTimeExtended* multiDay bool|null

Returns

  • ?string -

DurationToStringArray

\tp\TouchPointWP\Utilities\StringableArray tp\TouchPointWP\Utilities\DateFormats::DurationToStringArray(?\DateTimeInterface start, ?\DateTimeInterface end, ?bool multiDay, ?bool allDay)

Takes a start and end and returns one or two strings that are intended for use in a Meeting's Notable Attributes, but can be used for other similar cases.

  • Visibility: public
  • This method is static.

Arguments

  • start ?\DateTimeInterface* end ?\DateTimeInterface* multiDay ?bool* allDay ?bool

Returns

  • \tp\TouchPointWP\Utilities\StringableArray -