Back to the module list

Conversion of format

This class allow to convert a format to another one

The class definition

Class Domframework\Convert

Namespace Domframework

Description

/**
 Convert a format to another one

Properties

No property available

Methods

static public function convertDate ( $inputDate, $inputFormat, $outputFormat, $exception=true, $inputTimezone="Europe/Paris", $outputTimezone="Europe/Paris")
/**
 Convert Date received in one format to another.
 If the provided string is not corresponding to the format, generate an
 exception or return the original string
 Format used http://php.net/manual/en/datetime.createfromformat.php
 Do not accept the locale ! The language of the dates is always in english
 @param string $inputDate The date to modify
 @param string $inputFormat The input format of the date
 @param string $outputFormat The output format of the date
 @param boolean|null $exception If set, generate an exception if the
 provided date is invalid
 @param string|null $inputTimezone The timezone used to read the input
 By default, Europe/Paris
 @param string|null $outputTimezone The timezone used to write the output
 By default, Europe/Paris
 @return string

static public function humanSize ( $value, $decimals=2, $power=1000, $unit="B")
/**
 Convert the provided float to human readable format
 Example : 1440000 => 1.44MB
 @param float|integer $value The number to convert
 @param integer|null $decimals The number of decimal (2 by default)
 @param integer|null $power (1000 by default or 1024)
 @param string|null $unit The Unit displayed after the multiplier (B for
 Bytes by default)

static public function ucfirst ( $str)
/**
 Convert the first char to capital and the rest of the sentence in
 lowercase (like ucfirst, but UTF8 compliant)
 @param string $str The string to convert

static public function ucwords ( $str, $delimiters=" ")
/**
 Convert the first char of each word of a sentence to capital. The word
 delimiter can be provided.
 The sentence is in UTF-8.
 The sentence is converted to lowercase before doing the action (in
 contrary of the original PHP function)
 @param string $str The string to convert
 @param string $delimiters The delimiters (by default " \t\r\n\f\v")
 @return string