File/functions/date_functions.php

Description

CodeIgniter

An open source application development framework for PHP 4.3.2 or newer

Functions
date2mysql (line 442)

Recibe una fecha o fecha/hora en formato de MySql (YYYY-MM-DD HH:MM:SS) y la pasa al formato especificado por $cFormat.

Para saber mas sobre el formato consultar la documentacion de la funcion strftime en el manual de PHP.

string date2mysql ( $cDate, [string $cFormat = '%d/%m/%Y'], [ $nTime = true], string $cMySqlDate)
  • string $cMySqlDate
  • string $cFormat
  • $cDate
  • $nTime
date_diff (line 514)

Devuelve la diferencia entre dos fechas.

string date_diff (string $cFecha1, string $cFecha2)
  • string $cFecha1
  • string $cFecha2
days_in_month (line 70)

Number of days in a month

Takes a month/year as input and returns the number of days for the given month/year. Takes leap years into consideration.

  • access: public
integer days_in_month ([integer $month = false], [integer $year = false])
  • integer $month: a numeric month
  • integer $year: a numeric year
dec2hhmm (line 530)

Convierte una cantidad decimal a horas y minutos: 3.25 -> 03:15, 2.50 -> 02:30.

string dec2hhmm (string $nDecimal)
  • string $nDecimal
english_to_mysql (line 314)

Deuvelve la fecha para MySql.

El parametro $cFecha recibe YYYY/DD/MM (formato ingles)

string english_to_mysql (string $cFecha)
  • string $cFecha
gmt_to_local (line 129)

Converts GMT time to a localized value

Takes a Unix timestamp (in GMT) as input, and returns at the local value based on the timezone and DST setting submitted

  • access: public
integer gmt_to_local ([integer $time = false], [string $timezone = 'UTC'], [bool $dst = FALSE])
  • integer $time: Unix timestamp
  • string $timezone: timezone
  • bool $dst: whether DST is active
local_to_gmt (line 104)

Converts a local Unix timestamp to GMT

  • access: public
integer local_to_gmt ([integer $time = false])
  • integer $time: Unix timestamp
mdate (line 46)

Convert MySQL Style Datecodes

This function is identical to PHPs date() function, except that it allows date codes to be formatted using the MySQL style, where each code letter is preceded with a percent sign: %Y %m %d etc...

The benefit of doing dates this way is that you don't have to worry about escaping your text letters that match the date codes.

  • access: public
integer mdate (string $datestr, [integer $time = false])
  • string $datestr
  • integer $time
mysql2date (line 400)

Recibe una fecha o fecha/hora en formato de MySql (YYYY-MM-DD HH:MM:SS) y la pasa al formato especificado por $cFormat.

Para saber mas sobre el formato consultar la documentacion de la funcion strftime en el manual de PHP.

string mysql2date (string $cMySqlDate, [string $cFormat = '%d/%m/%Y'])
  • string $cMySqlDate
  • string $cFormat
mysql_to_english (line 329)

Deuvelve la fecha en formato ingles.

El parametro $cFecha recibe YYYY-MM-DD (mysql)

string mysql_to_english (string $cFecha)
  • string $cFecha
mysql_to_unix (line 154)

Converts a MySQL Timestamp to Unix

  • access: public
integer mysql_to_unix (integer $time)
  • integer $time: Unix timestamp
prepare_mysql_hour (line 350)

Formatea una hora para poder usarla en MySql.

El parametro $cHora puede ser algo como esto: 4, 15:50

El parametro $nForce es para forzar la hora a cero en caso que $cHora corresponda a un horario incorrecto, EJ: 36:98:45

string prepare_mysql_hour (string $cHora, [bool $nForce = false])
  • string $cHora
  • bool $nForce
sec2time (line 545)

Convierte una cantidad de segundos a formato HH:ii

string sec2time (string $nSegundos)
  • string $nSegundos
spanish_date (line 275)

Deuvelve la fecha en formato $cFormat.

%A = Lunes, Martes, etc %e = dia del mes 1~31 %B = Enero, Febrero, etc %Y = Año

string spanish_date ([ $cFormat = '%A, %e de %B de %Y'], [ $nTimestamp = null], [ $cLocale = APP_LOCALE], int $FechaStamp)
  • int $FechaStamp
  • $cFormat
  • $nTimestamp
  • $cLocale
timezones (line 215)

Timezones

Returns an array of timezones. This is a helper function for various other ones in this library

  • access: public
string timezones ([string $tz = false])
  • string $tz: timezone
unix_to_mysql (line 188)

Unix to "MySql"

Convierte una fecha en formato Unix a MySql

  • access: public
string unix_to_mysql ([integer $time = FALSE], [bool $seconds = TRUE])
  • integer $time: Unix timestamp
  • bool $seconds: whether to show seconds

Documentation generated on Tue, 22 Nov 2011 13:28:52 -0200 by phpDocumentor 1.4.3