WooCommerce Code Reference
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • WooCommerce Docs
  • REST API Docs

Packages

  • None
  • WooCommerce
    • Abstracts
    • Admin
      • Customize
      • Functions
      • Importers
      • Meta
      • Reports
      • System
    • API
    • Classes
      • Data
        • Store
      • Emails
      • Embed
      • Integrations
      • Interfaces
      • Log
        • Handlers
      • Payment
      • Products
      • Shipping
      • Walkers
    • Export
    • Functions
    • Import
    • l10n
    • PaymentTokens
    • PayPal
    • Shortcodes
      • Cart
      • Checkout
      • My
        • Account
      • Order
        • Tracking
    • Webhooks
    • Widgets
  • WP-Background-Processing

Classes

  • Abstract_WC_Order_Data_Store_CPT
  • WC_Abstract_Order
  • WC_AJAX
  • WC_Autoloader
  • WC_Background_Emailer
  • WC_Background_Process
  • WC_Background_Updater
  • WC_Breadcrumb
  • WC_Cache_Helper
  • WC_Cart
  • WC_Cart_Fees
  • WC_Cart_Session
  • WC_Cart_Totals
  • WC_Checkout
  • WC_Coupon
  • WC_Customer
  • WC_Customer_Download
  • WC_Customer_Download_Log
  • WC_DateTime
  • WC_Discounts
  • WC_Download_Handler
  • WC_Geo_IP
  • WC_Geo_IP_Record
  • WC_Geolocation
  • WC_HTTPS
  • WC_Install
  • WC_Legacy_Cart
  • WC_Legacy_Coupon
  • WC_Legacy_Customer
  • WC_Legacy_Payment_Token
  • WC_Legacy_Shipping_Zone
  • WC_Legacy_Webhook
  • WC_Log_Levels
  • WC_Logger
  • WC_Order
  • WC_Order_Data_Store_CPT
  • WC_Order_Factory
  • WC_Order_Item
  • WC_Order_Item_Coupon
  • WC_Order_Item_Fee
  • WC_Order_Item_Meta
  • WC_Order_Item_Product
  • WC_Order_Item_Shipping
  • WC_Order_Item_Tax
  • WC_Order_Query
  • WC_Order_Refund
  • WC_Payment_Gateway_CC
  • WC_Payment_Gateway_eCheck
  • WC_Payment_Tokens
  • WC_Product_Attribute
  • WC_Product_Data_Store_CPT
  • WC_Product_Download
  • WC_Product_Factory
  • WC_Product_Query
  • WC_Product_Variable_Data_Store_CPT
  • WC_Product_Variation
  • WC_Query
  • WC_Regenerate_Images
  • WC_Regenerate_Images_Request
  • WC_Register_WP_Admin_Settings
  • WC_Session_Handler
  • WC_Shipping_Zone
  • WC_Shipping_Zones
  • WC_Shortcodes
  • WC_Structured_Data
  • WC_Tax
  • WC_Template_Loader
  • WC_Tracker
  • WC_Twenty_Eleven
  • WC_Twenty_Fifteen
  • WC_Twenty_Fourteen
  • WC_Twenty_Seventeen
  • WC_Twenty_Sixteen
  • WC_Twenty_Ten
  • WC_Twenty_Thirteen
  • WC_Twenty_Twelve
  • WC_Validation

Class WC_DateTime

WC Wrapper for PHP DateTime which adds support for gmt/utc offset when a timezone is absent.

DateTime implements DateTimeInterface
Extended by WC_DateTime
Package: WooCommerce\Classes
Category: Class
Author: WooThemes
Since: 3.0.0
Class: WC_DateTime
Located at class-wc-datetime.php

Methods summary

public string
# __toString( )

Output an ISO 8601 date string in local (WordPress) timezone.

Output an ISO 8601 date string in local (WordPress) timezone.

Returns

string

Since

3.0.0
public
# set_utc_offset( integer $offset )

Set UTC offset - this is a fixed offset instead of a timezone.

Set UTC offset - this is a fixed offset instead of a timezone.

Parameters

$offset
public
# getOffset( )

Get UTC offset if set, or default to the DateTime object's offset.

Get UTC offset if set, or default to the DateTime object's offset.

Overrides

DateTime::getOffset
public DateTime
# setTimezone( DateTimeZone $timezone )

Set timezone.

Set timezone.

Parameters

$timezone

Returns

DateTime

Overrides

DateTime::setTimezone
public integer
# getTimestamp( )

Missing in PHP 5.2 so just here so it can be supported consistently.

Missing in PHP 5.2 so just here so it can be supported consistently.

Returns

integer

Since

3.0.0

Overrides

DateTime::getTimestamp
public integer
# getOffsetTimestamp( )

Get the timestamp with the WordPress timezone offset added or subtracted.

Get the timestamp with the WordPress timezone offset added or subtracted.

Returns

integer

Since

3.0.0
public string
# date( string $format )

Format a date based on the offset timestamp.

Format a date based on the offset timestamp.

Parameters

$format

Returns

string

Since

3.0.0
public string
# date_i18n( string $format = 'Y-m-d' )

Return a localised date based on offset timestamp. Wrapper for date_i18n function.

Return a localised date based on offset timestamp. Wrapper for date_i18n function.

Parameters

$format

Returns

string

Since

3.0.0

Methods inherited from DateTime

__construct(), __set_state(), __wakeup(), add(), createFromFormat(), diff(), format(), getLastErrors(), getTimezone(), modify(), setDate(), setISODate(), setTime(), setTimestamp(), sub()

Constants summary

Constants inherited from DateTime

ATOM, COOKIE, ISO8601, RFC1036, RFC1123, RFC2822, RFC3339, RFC3339_EXTENDED, RFC7231, RFC822, RFC850, RSS, W3C

Properties summary

protected integer $utc_offset

UTC Offset, if needed. Only used when a timezone is not set. When timezones are used this will equal 0.

UTC Offset, if needed. Only used when a timezone is not set. When timezones are used this will equal 0.

# 0
WooCommerce Code Reference API documentation generated by ApiGen