APIBoost A.P.I. documentation for PHPBoost CMS
  • Packages
    • Ajax
    • Builder
    • Content
    • Core
    • Default
    • Doctrine
    • Helper
    • IO
    • MVC
    • PHPBoost
    • Util
  • Interfaces
  • Classes
  • CacheData
  • CaptchaOptions
  • CommentsExtensionPoint
  • ConfigData
  • ContentFormattingExtensionPoint
  • Controller
  • CssFilesExtensionPoint
  • DAO
  • DataStore
  • DBConnection
  • DBMSFactory
  • DBMSUtils
  • ExtendedFieldExtensionPoint
  • ExtensionPoint
  • ExternalAuthentication
  • FeedProvider
  • FileReader
  • FileWriter
  • FormattingParser
  • FormButton
  • FormConstraint
  • FormElement
  • FormField
  • FormFieldConstraint
  • FormFieldEnumOption
  • FormFieldset
  • GraphicalEnvironment
  • HomePage
  • HomePageExtensionPoint
  • HTMLElement
  • HTMLTableFilter
  • InjectQueryResult
  • MailService
  • MemberExtendedFieldType
  • MenusExtensionPoint
  • ModuleSetup
  • ModuleTreeLinksExtensionPoint
  • PropertiesMapInterface
  • QueryResult
  • Response
  • ScheduledJobExtensionPoint
  • SearchableExtensionPoint
  • SelectQueryResult
  • SQLFragmentBuilder
  • SQLQuerier
  • SQLQueryTranslator
  • Template
  • TemplateData
  • TemplateLoader
  • TemplateParser
  • TemplateRenderer
  • TemplateSyntaxElement
  • UrlMapper
  • UrlMappingsExtensionPoint
  • View
  • AbstractAdminItemController
  • AbstractCategoriesFormController
  • AbstractCategoriesManagementController
  • AbstractCommentsBuildForm
  • AbstractCommentsController
  • AbstractConfigData
  • AbstractContentFormattingExtensionPoint
  • AbstractController
  • AbstractDeleteCategoryController
  • AbstractDisplayGraphicalEnvironment
  • AbstractFormButton
  • AbstractFormField
  • AbstractFormFieldChoice
  • AbstractFormFieldConstraint
  • AbstractFormFieldEnumOption
  • AbstractFormFieldset
  • AbstractGraphicalEnvironment
  • AbstractHTMLElement
  • AbstractHTMLTableFilter
  • AbstractItemController
  • AbstractMemberExtendedField
  • AbstractParser
  • AbstractPHPMailerMailService
  • AbstractPlatform
  • AbstractQueryResult
  • AbstractResponse
  • AbstractScheduledJobExtensionPoint
  • AbstractSearchableExtensionPoint
  • AbstractSelectQueryResult
  • AbstractSQLQuerier
  • AbstractTemplate
  • AbstractTemplateParser
  • AbstractTemplateSyntaxElement
  • AbstractUrlMapper
  • ActionAuthorization
  • AddCommentBuildForm
  • AdminController
  • AdminDisplayFrameGraphicalEnvironment
  • AdminDisplayFrameResponse
  • AdminDisplayGraphicalEnvironment
  • AdminDisplayResponse
  • AdministratorAlert
  • AdministratorAlertCache
  • AdministratorAlertService
  • AdminMenuDisplayResponse
  • AdminModuleController
  • AdminModuleLink
  • AdminNodisplayGraphicalEnvironment
  • AdminNodisplayResponse
  • AjaxCommentsDisplayController
  • AjaxCommentsNotationController
  • AjaxImagePreviewController
  • AjaxKeywordsAutoCompleteController
  • AjaxRequest
  • AjaxSearchUserAutoCompleteController
  • AjaxUrlValidationController
  • AjaxUserAutoCompleteController
  • APCDataStore
  • AppContext
  • Application
  • ArrayContentTemplateSyntaxElement
  • Arrays
  • ArrayTemplateSyntaxElement
  • ArrayType
  • ATOM
  • AuthenticationMethod
  • AuthenticationService
  • Authorizations
  • AuthorizationsSettings
  • AutoConnectData
  • BBCodeHighlighter
  • Bench
  • BigIntType
  • BooleanType
  • BreadCrumb
  • BrHTMLElement
  • BufferedFileReader
  • BufferedFileWriter
  • BusinessObject
  • CacheDataNotFoundException
  • CachedMenu
  • CachedStringTemplateLoader
  • CacheManager
  • CacheService
  • Captcha
  • CaptchaProvidersService
  • CaptchaService
  • CategoriesAuthorizationsService
  • CategoriesCache
  • CategoriesItemsParameters
  • CategoriesManager
  • CategoriesService
  • CategoriesUrlBuilder
  • Category
  • CategoryNotFoundException
  • ClassLoader
  • ColumnsDisabled
  • CommentsAuthorizations
  • CommentsCache
  • CommentsConfig
  • CommentsDAO
  • CommentsManager
  • CommentsProvidersService
  • CommentsService
  • CommentsTopic
  • CommentsTopicDAO
  • CommentsTopicEvents
  • CommentsTopics
  • CommentsUrlBuilder
  • ConditionTemplateSyntaxElement
  • ConfigManager
  • ConfigNotFoundException
  • ConstantTemplateSyntaxElement
  • ContentEditor
  • ContentFormattingConfig
  • ContentFormattingParser
  • ContentFormattingProvidersService
  • ContentFormattingService
  • ContentFormattingUnparser
  • ContentManagementConfig
  • ContentMenu
  • ContentSecondParser
  • ContentSharingActionsMenuLink
  • ContentSharingActionsMenuLinksExtensionPoint
  • ContentSharingActionsMenuService
  • Contribution
  • ContributionService
  • CookieBarConfig
  • Countries
  • CSSCacheConfig
  • CSSCacheManager
  • CSSFileOptimizer
  • CurrentUser
  • CustomizationConfig
  • CustomizeInterface
  • DataStoreException
  • DataStoreFactory
  • Date
  • DateTimeType
  • DateType
  • DBConnectionException
  • DBFactory
  • DBQuerier
  • Debug
  • DecimalType
  • DefaultAdminDisplayResponse
  • DefaultAjaxDeleteItemController
  • DefaultCategoriesCache
  • DefaultCategoriesFeedProvider
  • DefaultCategoriesFormController
  • DefaultCategoriesManagementController
  • DefaultCommentsTopic
  • DefaultConfigurationController
  • DefaultDeleteCategoryController
  • DefaultDeleteItemController
  • DefaultDisplayItemController
  • DefaultHomePage
  • DefaultHomePageDisplay
  • DefaultItemsManagementController
  • DefaultMailService
  • DefaultModuleConfig
  • DefaultModuleSetup
  • DefaultRichCategoriesCache
  • DefaultRichModuleConfig
  • DefaultScheduledJobsModule
  • DefaultSearchable
  • DefaultSeveralItemsController
  • DefaultSitemapCategoriesModule
  • DefaultSitemapModule
  • DefaultTemplateData
  • DefaultTemplateRenderer
  • DefaultTreeLinks
  • DeleteLinkHTMLElement
  • Dispatcher
  • DispatcherException
  • DispatcherUrlMapping
  • DispatchManager
  • DivHTMLElement
  • DoctrineException
  • EditCommentBuildForm
  • EditLinkHTMLElement
  • Environment
  • ErrorHandler
  • Event
  • ExceptionHandler
  • ExceptionUtils
  • ExpressionContentTemplateSyntaxElement
  • ExpressionTemplateSyntaxElement
  • ExtendedField
  • ExtendedFields
  • ExtendedFieldsCache
  • ExtendedFieldsDatabaseService
  • ExtendedFieldsService
  • ExtensionPointNotFoundException
  • ExtensionPointProvider
  • ExtensionPointProviderService
  • ExternalAuthenticationsExtensionPoint
  • Feed
  • FeedData
  • FeedItem
  • FeedItemEnclosure
  • FeedMenu
  • FeedsCat
  • FeedsCategoriesModule
  • FeedsList
  • File
  • FileSystemDataStore
  • FileSystemElement
  • FileSystemHelper
  • FileTemplate
  • FileTemplateLoader
  • FileTemplateLoadingException
  • FileTemplateRenderingException
  • FileType
  • FileUploadConfig
  • FileUploadService
  • Filter
  • FloatType
  • Folder
  • FormatingHelper
  • FormBuilderDisabledFieldException
  • FormBuilderException
  • FormButtonAjax
  • FormButtonAjaxCssImg
  • FormButtonButton
  • FormButtonButtonCssImg
  • FormButtonDefaultSubmit
  • FormButtonLink
  • FormButtonLinkCssImg
  • FormButtonReset
  • FormButtonSubmit
  • FormButtonSubmitCssImg
  • FormButtonSubmitImg
  • FormConstraintFieldsDifferenceInferior
  • FormConstraintFieldsDifferenceSuperior
  • FormConstraintFieldsEquality
  • FormConstraintFieldsInequality
  • FormConstraintFieldsNotIncluded
  • FormFieldActionLink
  • FormFieldActionLinkElement
  • FormFieldActionLinkList
  • FormFieldAjaxCompleter
  • FormFieldAjaxSearchUserAutoComplete
  • FormFieldAjaxUserAutoComplete
  • FormFieldAuthorizationsSetter
  • FormFieldBooleanInformation
  • FormFieldCaptcha
  • FormFieldCategoriesSelect
  • FormFieldCheckbox
  • FormFieldColorPicker
  • FormFieldConstraintAntiFlood
  • FormFieldConstraintDate
  • FormFieldConstraintDisplayNameExists
  • FormFieldConstraintFileExtension
  • FormFieldConstraintFileMaxSize
  • FormFieldConstraintForbiddenMailDomains
  • FormFieldConstraintIntegerMax
  • FormFieldConstraintIntegerMin
  • FormFieldConstraintIntegerRange
  • FormFieldConstraintLengthMax
  • FormFieldConstraintLengthMin
  • FormFieldConstraintLengthRange
  • FormFieldConstraintMailAddress
  • FormFieldConstraintMailExist
  • FormFieldConstraintMaxLinks
  • FormFieldConstraintNotEmpty
  • FormFieldConstraintPasswordStrength
  • FormFieldConstraintPHPBoostAuthLoginExists
  • FormFieldConstraintPictureFile
  • FormFieldConstraintRegex
  • FormFieldConstraintTel
  • FormFieldConstraintUrl
  • FormFieldConstraintUrlExists
  • FormFieldConstraintUserExist
  • FormFieldCSRFToken
  • FormFieldDate
  • FormFieldDateTime
  • FormFieldDecimalNumberEditor
  • FormFieldEditors
  • FormFieldFilePicker
  • FormFieldFree
  • FormFieldGroups
  • FormFieldHidden
  • FormFieldHTML
  • FormFieldLabel
  • FormFieldLangsSelect
  • FormFieldMailEditor
  • FormFieldMemberCaution
  • FormFieldMemberSanction
  • FormFieldMenuFieldset
  • FormFieldMultiLineTextEditor
  • FormFieldMultipleAutocompleter
  • FormFieldMultipleCheckbox
  • FormFieldMultipleCheckboxOption
  • FormFieldMultipleSelectChoice
  • FormFieldMultipleValuedCheckboxOption
  • FormFieldMultitabsLink
  • FormFieldMultitabsLinkElement
  • FormFieldMultitabsLinkList
  • FormFieldNumberEditor
  • FormFieldPasswordEditor
  • FormFieldPossibleValues
  • FormFieldRadioChoice
  • FormFieldRadioChoiceOption
  • FormFieldRangeEditor
  • FormFieldRanksSelect
  • FormFieldRichTextEditor
  • FormFieldSearch
  • FormFieldSelectChoiceGroupOption
  • FormFieldSelectChoiceOption
  • FormFieldSelectSources
  • FormFieldsetAccordionControls
  • FormFieldsetHidden
  • FormFieldsetHorizontal
  • FormFieldsetHTML
  • FormFieldsetHTMLHeading
  • FormFieldsetMultitabsHTML
  • FormFieldsetSubmit
  • FormFieldsetVertical
  • FormFieldShortMultiLineTextEditor
  • FormFieldSimpleSelectChoice
  • FormFieldSpacer
  • FormFieldSubTitle
  • FormFieldTelEditor
  • FormFieldTextEditor
  • FormFieldThemesSelect
  • FormFieldThumbnail
  • FormFieldTimezone
  • FormFieldUploadFile
  • FormFieldUploadPictureFile
  • FormFieldUrlEditor
  • FunctionCallTemplateSyntaxElement
  • FunctionTemplateSyntaxElement
  • GeneralConfig
  • GraphicalEnvironmentConfig
  • GroupsCache
  • GroupsService
  • HtaccessFileCache
  • HTMLForm
  • HTMLTable
  • HTMLTableAjaxUserAutoCompleteFilter
  • HTMLTableAjaxUserAutoCompleteSQLFilter
  • HTMLTableBeginsWithTextSQLFilter
  • HTMLTableCheckboxFilter
  • HTMLTableColumn
  • HTMLTableDateComparatorSQLFilter
  • HTMLTableDateGreaterThanOrEqualsToSQLFilter
  • HTMLTableDateLessThanOrEqualsToSQLFilter
  • HTMLTableDateTimeGreaterThanOrEqualsToSQLFilter
  • HTMLTableDateTimeLessThanOrEqualsToSQLFilter
  • HTMLTableEndsWithTextSQLFilter
  • HTMLTableEqualsFromListFilter
  • HTMLTableEqualsFromListSQLFilter
  • HTMLTableEqualsToSQLFilter
  • HTMLTableEscapedLikeTextSQLFilter
  • HTMLTableGreaterThanOrEqualsToSQLFilter
  • HTMLTableGreaterThanSQLFilter
  • HTMLTableLessThanOrEqualsToSQLFilter
  • HTMLTableLessThanSQLFilter
  • HTMLTableLikeFromListSQLFilter
  • HTMLTableLikeTextSQLFilter
  • HTMLTableModel
  • HTMLTableNumberComparatorSQLFilter
  • HTMLTableParameters
  • HTMLTableRow
  • HTMLTableRowCell
  • HTMLTableSortingRule
  • HTMLTableTextFilter
  • HTMLTableUnapprovedSQLFilter
  • HTTPCookie
  • HTTPFatalExceptionPrinter
  • HTTPRequestCustom
  • HTTPResponseCustom
  • I18NMessages
  • IdcardService
  • IllegalArgumentException
  • Image
  • ImageResizer
  • ImgHTMLElement
  • IncludeTemplateSyntaxElement
  • IntegerType
  • IntegratedErrorHandler
  • InvalidTemplateFunctionCallException
  • IOException
  • Item
  • ItemsAuthorizationsService
  • ItemsManager
  • ItemsModuleExtensionPointProvider
  • ItemsService
  • ItemsUrlBuilder
  • JoinMappingModel
  • JSONResponse
  • KeyGenerator
  • Keyword
  • KeywordsCache
  • KeywordsManager
  • KeywordsService
  • Lang
  • LangConfiguration
  • LangConfigurationManager
  • LangLoader
  • LangNotFoundException
  • LangsConfig
  • LangsManager
  • LangVarTemplateSyntaxElement
  • LastUseDateConfig
  • LinkHTMLElement
  • LinksMenu
  • LinksMenuElement
  • LinksMenuLink
  • LoopTemplateSyntaxElement
  • LoopVarTemplateSyntaxElement
  • Mail
  • MailServiceConfig
  • MailToPHPMailerConverter
  • MailUtil
  • MaintenanceConfig
  • MalformedUrlMapperRegexException
  • MappingModel
  • MappingModelField
  • MemberDateExtendedField
  • MemberDisabledActionAuthorization
  • MemberExtendedField
  • MemberExtendedFieldErrorsMessageException
  • MemberExtendedFieldsService
  • MemberHalfLongTextExtendedField
  • MemberHiddenExtendedField
  • MemberLongTextExtendedField
  • MemberMultipleChoiceExtendedField
  • MemberMultipleSelectExtendedField
  • MemberSanctionManager
  • MemberShortTextExtendedField
  • MemberSimpleChoiceExtendedField
  • MemberSimpleSelectExtendedField
  • MemberUserAvatarExtendedField
  • MemberUserBornExtendedField
  • MemberUserPMToMailExtendedField
  • MemberUserSexExtendedField
  • Menu
  • MenusCache
  • MenuService
  • MenusProvidersService
  • MenuStringFilter
  • MessageHelper
  • MiniCalendar
  • Module
  • ModuleConfiguration
  • ModuleConfigurationManager
  • ModuleController
  • ModuleCssFiles
  • ModuleDispatchManager
  • ModuleExtensionPointProvider
  • ModuleLink
  • ModuleMenus
  • ModuleMiniMenu
  • ModulePagination
  • ModulesConfig
  • ModulesCssFilesService
  • ModulesManager
  • ModulesUrlBuilder
  • ModuleTreeLinks
  • ModuleTreeLinksService
  • MySQLDBConnection
  • MySQLDBConnectionException
  • MySQLDBFactory
  • MySQLDBMSUtils
  • MySQLInjectQueryResult
  • MySqlPlatform
  • MySQLQuerier
  • MySQLQuerierException
  • MySQLQueryTranslator
  • MySQLSelectQueryResult
  • MySQLUnexistingDatabaseException
  • NginxFileCache
  • NoSuchControllerException
  • NotASingleRowFoundException
  • Notation
  • NotationService
  • Notification
  • NotYetImplementedException
  • NoUrlMatchException
  • NumberHelper
  • ObjectNotFoundException
  • ObjectType
  • Pagination
  • ParametersTemplateSyntaxElement
  • ParameterTypeMismatchException
  • Path
  • PDODBConnection
  • PDODBConnectionException
  • PDOInjectQueryResult
  • PDOMySQLDBFactory
  • PDOQuerier
  • PDOQuerierException
  • PDOSelectQueryResult
  • PersistenceContext
  • PHPBoostAuthenticationMethod
  • PHPBoostErrors
  • PHPBoostFoldersPermissions
  • PHPBoostIndexController
  • PHPBoostNotInstalledException
  • PHPTemplateSyntaxElement
  • PlainCodeHighlighter
  • PostgreSqlPlatform
  • PrivateMsg
  • PropertyNotFoundException
  • RAMDataStore
  • RawExceptionHandler
  • RegexHelper
  • RemainingStringVarException
  • Repository
  • RichCategory
  • RichItem
  • RichRootCategory
  • Robots
  • RolesAuthorizations
  • RootCategory
  • RowNotFoundException
  • RSS
  • SearchCategoryChildrensOptions
  • SearchResult
  • SecurityConfig
  • SelectQueryResultMapper
  • SEOMetaData
  • ServerConfiguration
  • ServerEnvironmentConfig
  • Session
  • SessionData
  • SessionNotFoundException
  • SessionsConfig
  • SimpleVarTemplateSyntaxElement
  • SiteDisplayFrameGraphicalEnvironment
  • SiteDisplayFrameResponse
  • SiteDisplayGraphicalEnvironment
  • SiteDisplayResponse
  • SitemapCategoriesModule
  • SiteNodisplayGraphicalEnvironment
  • SiteNodisplayResponse
  • SmallIntType
  • SmileysCache
  • SMTPConfiguration
  • SMTPMailService
  • SpanHTMLElement
  • SQLDAO
  • SQLFragment
  • SQLHTMLTableModel
  • SqlitePlatform
  • SQLQuerierException
  • SQLQueryVars
  • StatsCache
  • StringInputStream
  • StringOutputStream
  • StringTemplate
  • StringTemplateLoader
  • StringType
  • StringVars
  • TemplateFunctions
  • TemplateHighlighter
  • TemplateLoadingException
  • TemplateRenderingException
  • TemplateSyntaxParser
  • TemplateSyntaxParserContext
  • TextHelper
  • TextTemplateSyntaxElement
  • TextType
  • Theme
  • ThemeConfiguration
  • ThemeConfigurationManager
  • ThemesConfig
  • ThemesManager
  • TimeType
  • Timezone
  • Type
  • UnexistingDatabaseException
  • UnexistingExtensionPointProviderException
  • UnexistingHTTPParameterException
  • UnreadContributionsCache
  • UnsupportedOperationException
  • Updates
  • Upload
  • UploadedFile
  • UploadedFileTooLargeException
  • Uploads
  • Url
  • UrlControllerMapper
  • UrlMapping
  • UrlMappings
  • UrlRedirectMapper
  • UrlSerializedParameter
  • UrlSerializedParameterEncoder
  • UrlSerializedParameterParser
  • User
  • UserAccountsConfig
  • UserService
  • ValidationResult
  • VariableExpressionTemplateSyntaxElement
  • VariableTemplateSyntaxElement
  • VisitorDisabledActionAuthorization
  • WizardActionLinkList
  • WizardFormFieldsetSubmit
  • WizardHTMLForm
  • WritingPadConfig
Methods
  • __construct()
  • format()
  • get_date_relative()
  • get_timestamp()
  • get_date_time()
  • get_year()
  • set_year()
  • get_month()
  • set_month()
  • get_month_text()
  • get_week_number()
  • set_week_number()
  • get_day()
  • get_day_two_digits()
  • set_day()
  • get_day_text()
  • get_day_of_week()
  • get_day_of_year()
  • set_day_of_year()
  • get_hours()
  • set_hours()
  • get_minutes()
  • set_minutes()
  • get_seconds()
  • set_seconds()
  • to_date()
  • is_anterior_to()
  • is_posterior_to()
  • equals()
  • add_days()
  • add_weeks()
  • is_date_year_bissextile()
  • to_format()
  • set_default_timezone()
  • get_array_tpl_vars()
  • No protected methods found
  • check_date()
  • compute_server_user_difference()
  • transform_date()
Properties
  • No public properties found
  • No protected properties found
  • $date_time
Constants
  • DATE_NOW
  • FORMAT_TIMESTAMP
  • FORMAT_DAY_MONTH
  • FORMAT_DAY_MONTH_YEAR
  • FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE
  • FORMAT_RFC2822
  • FORMAT_ISO8601
  • FORMAT_DAY_MONTH_YEAR_LONG
  • FORMAT_DAY_MONTH_YEAR_TEXT
  • FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE_TEXT
  • FORMAT_RELATIVE
  • FORMAT_ISO_DAY_MONTH_YEAR
  • FORMAT_DIFF_NOW
  1. APIBoost
  2. \Util
  3. Date

Class Date

Summary

  • File
  • Package hierarchy Util
  • Class hierarchy \Date
  • package

    Util

  • copyright

    © 2005-2020 PHPBoost

  • license

    https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0

  • author

    Benoit SAUTEL ben.popeye@phpboost.com

  • version

    PHPBoost 6.0 - last update: 2018 03 23

  • since

    PHPBoost 2.0 - 2008 06 01

  • contributor

    Julien BRISWALTER j1.seth@phpboost.com

  • contributor

    Arnaud GENET elenwii@phpboost.com

  • contributor

    mipel mipel@phpboost.com

This class allows you to handle easily some dates. A date is a day and an hour (year, month, day, hour, minutes, seconds).

It supports the most common formats and manages timezones. Here are the definitions of the 3 existing timezones:

  • System timezone: it's the timezone of the server, configured by the hoster. For instance, if your server is in France, it should be GMT+1.
  • Site timezone: it's the timezone of the central place of the site. For example, if your site deals with the italian soccer championship, it will be GMT+1.
  • User timezone : each registered user can specify its timezone. It's particulary useful for people who visit some sites from a foreign country.

Methods

__construct()

__construct( $time = self::DATE_NOW,  $referencial_timezone = \Timezone::USER_TIMEZONE) 

Builds and initializes a date.

The first parameter is the date in a standardized format defined in the PHP documentation. To get the current date, use the Date::DATE_NOW The second parameter allows us to chose what time referential we use to create the date:

  • Timezone::SERVER_TIMEZONE if that date comes from for example the database (dates must be stored under this referential).
  • Timezone::SITE_TIMEZONE if it's an entry coming from the site (nearly never used).
  • Timezone::USER_TIMEZONE if it's an entry coming from the user (it's own timezone will be used)
Parameters
$time
$referencial_timezone
  • Inherited from \Date
Tags
None found

format()

format(integer $format = self::FORMAT_DAY_MONTH, integer $referencial_timezone = \Timezone::USER_TIMEZONE) : string

Formats the date to a particular format.

Parameters
integer $format

One of the following enumeration:

  • Date::FORMAT_DAY_MONTH for a tiny formatting (only month and day)
  • Date::FORMAT_DAY_MONTH_YEAR for a short formatting (month, day, year)
  • Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE for a longer displaying (year, month, day, hour and minutes)
  • Date::FORMAT_TIMESTAMP for a timestamp
  • Date::FORMAT_RFC822 to format according to what the RFC822 announces
  • Date::FORMAT_ISO8601 to format according to what the ISO8601 announces
  • Date::FORMAT_DAY_MONTH_YEAR_LONG
  • Date::FORMAT_DAY_MONTH_YEAR_TEXT
  • Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE_TEXT
  • Date::FORMAT_RELATIVE
  • Date::FORMAT_ISO_DAY_MONTH_YEAR
  • Date::FORMAT_DIFF_NOW
integer $referencial_timezone

One of the following enumeration:

  • Timezone::SERVER_TIMEZONE
  • Timezone::SITE_TIMEZONE
  • Timezone::USER_TIMEZONE
Returns
string —

The formatted date

  • Inherited from \Date
Tags
None found

get_date_relative()

get_date_relative(integer $timestamp, integer $referencial_timezone) : string

Returns the relative time associated to the date

Parameters
integer $timestamp
integer $referencial_timezone
Returns
string —

The relative time

  • Inherited from \Date
Tags
None found

get_timestamp()

get_timestamp() : integer

Returns the timestamp associated to the date

Returns
integer —

The timestamp

  • Inherited from \Date
Tags
None found

get_date_time()

get_date_time() : \DateTime

Returns DateTime

Returns
\DateTime
  • Inherited from \Date
Tags
None found

get_year()

get_year( $timezone = \Timezone::USER_TIMEZONE) : string

Returns the year of the date

Parameters
$timezone

The timezone in which you want this value

Returns
string —

The year

  • Inherited from \Date
Tags
None found

set_year()

set_year( $year,  $referential_timezone = \Timezone::USER_TIMEZONE) 

Parameters
$year
$referential_timezone
  • Inherited from \Date
Tags
None found

get_month()

get_month( $timezone = \Timezone::USER_TIMEZONE) : string

Returns the month of the date

Parameters
$timezone

The timezone in which you want this value

Returns
string —

The month

  • Inherited from \Date
Tags
None found

set_month()

set_month( $month,  $referential_timezone = \Timezone::USER_TIMEZONE) 

Parameters
$month
$referential_timezone
  • Inherited from \Date
Tags
None found

get_month_text()

get_month_text( $characters_number = '',  $timezone = \Timezone::USER_TIMEZONE) : string

Returns first charaters (all per default) of the month name

Parameters
$characters_number

The characters number requested (usually 2 or 3)

$timezone

The timezone in which you want this value

Returns
string —

The first letters of the month name

  • Inherited from \Date
Tags
None found

get_week_number()

get_week_number( $referential_timezone = \Timezone::USER_TIMEZONE) : string

Returns the week number of the date

Parameters
$referential_timezone
Returns
string —

The week number

  • Inherited from \Date
Tags
None found

set_week_number()

set_week_number( $week_number) 

Parameters
$week_number
  • Inherited from \Date
Tags
None found

get_day()

get_day( $timezone = \Timezone::USER_TIMEZONE) : string

Returns the day of the date

Parameters
$timezone

The timezone in which you want this value

Returns
string —

The day

  • Inherited from \Date
Tags
None found

get_day_two_digits()

get_day_two_digits( $timezone = \Timezone::USER_TIMEZONE) 

Parameters
$timezone
  • Inherited from \Date
Tags
None found

set_day()

set_day( $day,  $referential_timezone = \Timezone::USER_TIMEZONE) 

Parameters
$day
$referential_timezone
  • Inherited from \Date
Tags
None found

get_day_text()

get_day_text( $characters_number = '',  $timezone = \Timezone::USER_TIMEZONE) : string

Returns first charaters (all per default) of the day of week name

Parameters
$characters_number

The characters number requested (usually 2 or 3)

$timezone

The timezone in which you want this value

Returns
string —

The first letters of the day name

  • Inherited from \Date
Tags
None found

get_day_of_week()

get_day_of_week( $timezone = \Timezone::USER_TIMEZONE) : string

Returns the day of the week (0 for sunday to 6 for saturday)

Parameters
$timezone

The timezone in which you want this value

Returns
string —

The day of the year

  • Inherited from \Date
Tags
None found

get_day_of_year()

get_day_of_year( $timezone = \Timezone::USER_TIMEZONE) : string

Returns the day of the year

Parameters
$timezone

The timezone in which you want this value

Returns
string —

The day of the year

  • Inherited from \Date
Tags
None found

set_day_of_year()

set_day_of_year( $day_of_year) 

Parameters
$day_of_year
  • Inherited from \Date
Tags
None found

get_hours()

get_hours( $timezone = \Timezone::USER_TIMEZONE) : string

Returns the hours of the date

Parameters
$timezone

The timezone in which you want this value

Returns
string —

The hours

  • Inherited from \Date
Tags
None found

set_hours()

set_hours( $hours,  $referential_timezone = \Timezone::USER_TIMEZONE) 

Parameters
$hours
$referential_timezone
  • Inherited from \Date
Tags
None found

get_minutes()

get_minutes() : string

Returns the minutes of the date

Returns
string —

The minutes

  • Inherited from \Date
Tags
None found

set_minutes()

set_minutes( $minutes,  $referential_timezone = \Timezone::USER_TIMEZONE) 

Parameters
$minutes
$referential_timezone
  • Inherited from \Date
Tags
None found

get_seconds()

get_seconds() : string

Returns the seconds of the date

Returns
string —

The seconds

  • Inherited from \Date
Tags
None found

set_seconds()

set_seconds( $seconds,  $referential_timezone = \Timezone::USER_TIMEZONE) 

Parameters
$seconds
$referential_timezone
  • Inherited from \Date
Tags
None found

to_date()

to_date() : string

Exports the date according to the format YYYY-mm-dd

Returns
string —

The formatted date

  • Inherited from \Date
Tags
None found

is_anterior_to()

is_anterior_to(\Date $date) : boolean

Tells whether this date is anterior to the given one

Parameters
\Date $date

The date to compare with

Returns
boolean
  • Inherited from \Date
Tags
None found

is_posterior_to()

is_posterior_to(\Date $date) : boolean

Tells whether this date is posterior to the given one

Parameters
\Date $date

The date to compare with

Returns
boolean
  • Inherited from \Date
Tags
None found

equals()

equals(\Date $date) : boolean

Tells whether this date equals the given one

Parameters
\Date $date

The date to compare with.

Returns
boolean —

true if the two dates are the same, false otherwise

  • Inherited from \Date
Tags
None found

add_days()

add_days(integer $number_days) 

Adds the given number of days to the date

Parameters
integer $number_days

The number of days to add.

  • Inherited from \Date
Tags
None found

add_weeks()

add_weeks(integer $number_weeks) 

Adds the given number of weeks to the date

Parameters
integer $number_weeks

The number of weeks to add.

  • Inherited from \Date
Tags
None found

is_date_year_bissextile()

is_date_year_bissextile() : boolean

Tells whether the year of the date is bissextile

Returns
boolean —

true if the year is bissextile, false otherwise

  • Inherited from \Date
Tags
None found

to_format()

to_format( $time,  $format = self::FORMAT_DAY_MONTH,  $referencial_timezone = \Timezone::USER_TIMEZONE) 

Parameters
$time
$format
$referencial_timezone
static
  • Inherited from \Date
Tags
None found

set_default_timezone()

set_default_timezone() 

static
  • Inherited from \Date
Tags
None found

get_array_tpl_vars()

get_array_tpl_vars(\Date $date, string $date_label) : array<mixed,string>

Calculates and return date formats to use many variables in the TPL.

Parameters
\Date $date

The concerned date

string $date_label

The purpose of the date

Returns
array<mixed,string> —

true if the date is correct and false otherwise.

static
  • Inherited from \Date
Tags
None found

check_date()

check_date(integer $month, integer $day, integer $year) : boolean

Determines whether a date is correct. For example the february 31st is not correct.

Parameters
integer $month

The month

integer $day

The day

integer $year

The year

Returns
boolean —

true if the date is correct and false otherwise.

static
  • Inherited from \Date
Tags
None found

compute_server_user_difference()

compute_server_user_difference( $referencial_timezone = \Timezone::SERVER_TIMEZONE) : integer

Computes the time difference between the server and the current user

Parameters
$referencial_timezone
Returns
integer —

The time difference (in hours)

  • Inherited from \Date
Tags
None found

transform_date()

transform_date( $date) 

Parameters
$date
static
  • Inherited from \Date
Tags
None found

Properties

$date_time

$date_time : \DateTime

\DateTime — Representation of date and time.
Tags
None found

Constants

DATE_NOW

DATE_NOW = 'now'

Tags
None found

FORMAT_TIMESTAMP

FORMAT_TIMESTAMP = 0

Tags
None found

FORMAT_DAY_MONTH

FORMAT_DAY_MONTH = 1

Tags
None found

FORMAT_DAY_MONTH_YEAR

FORMAT_DAY_MONTH_YEAR = 2

Tags
None found

FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE

FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE = 3

Tags
None found

FORMAT_RFC2822

FORMAT_RFC2822 = 4

Tags
None found

FORMAT_ISO8601

FORMAT_ISO8601 = 5

Tags
None found

FORMAT_DAY_MONTH_YEAR_LONG

FORMAT_DAY_MONTH_YEAR_LONG = 6

Tags
None found

FORMAT_DAY_MONTH_YEAR_TEXT

FORMAT_DAY_MONTH_YEAR_TEXT = 7

Tags
None found

FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE_TEXT

FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE_TEXT = 8

Tags
None found

FORMAT_RELATIVE

FORMAT_RELATIVE = 9

Tags
None found

FORMAT_ISO_DAY_MONTH_YEAR

FORMAT_ISO_DAY_MONTH_YEAR = 10

Tags
None found

FORMAT_DIFF_NOW

FORMAT_DIFF_NOW = 11

Tags
None found
Documentation is powered by phpDocumentor and generated on Thu, 25 Jun 2020 11:10:07 +0200.