to the blog ... weather
 

TCDate Examples

The local date and time: Friday, September 10th, 2010 at 8:02:46 PM PDT

The UTC date and time: Saturday, September 11th, 2010 at 3:02:46 AM GMT


The TCDate (local): TC27:82

The TCDate (UTC): TC27:82


Formatted Examples

The TCDate (local): Aleph 1, Large Scale 1, in the cycle 7, Thoth Count27:82 Friday 8:02:46 PM PDT Count Method: Long Count

The TCDate (UTC): Aleph 1, Large Scale 1, in the cycle 7, Thoth Count27:82 Saturday 3:02:46 AM GMT Count Method: Long Count

Time and date (any string acceptible to PHP strtotime() function):

Format for TCDate (See the documentation section below):

Method for counting cycles/Alephs (see the documentation section below):
Short Count
Long Count

Download

You can download the files (including this example) here: TCDate version 1.0

Documentation

function tc_date([string format[,int timestamp[, string counting method]]])

The parameters can be omitted, right to left and will be replaced as explained below.

Returns a formatted TC Date string

@param format the String format:
Characters in the format string that are not present in the list below are added as is to the return string.

To add characters that are in the list below prepend them with a backslash as in '\T\he \D\a\te \i\s tY:d'

 ----- Epochs and Large scale time -----
 X : Aleph Example: 1 (Negative numbers represent dates before Aleph 1, Year 1, Day 1)
 L : Large Scale Count (there are 1000 in an Aleph) Example: 3
 C : Cycle (there are either 4 or 9 in a Large Scale) Example: 2
 ----- Dates ----------------------
 Y : Year (there are 4 in a cycle) Example: 15
 y : Year [same as Y - added for convenience]
 d : Day with leading 0 (there are 88 in a year) 01 to 88
 j : Day with no leading 0 Example : 1 to 88
 D : A textual representation of a day, three letters  	Mon through Sun
 l (lowercase 'L') : A full textual representation of the day of the week
 ----- Time ------------------------
 a : Lowercase Ante meridiem and Post meridiem  	am or pm
 A : Uppercase Ante meridiem and Post meridiem 	AM or PM
 g : 12-hour format of an hour without leading zeros 	1 through 12
 G : 24-hour format of an hour without leading zeros 	0 through 23
 h : 12-hour format of an hour with leading zeros 	01 through 12
 H : 24-hour format of an hour with leading zeros 	00 through 23
 i : Minutes with leading zeros 	00 to 59
 s : Seconds, with leading zeros 	00 through 59
 ----- Timezone 	--- 
 e 	Timezone identifier (added in PHP 5.1.0) 	Examples: UTC, GMT, Atlantic/Azores
 I (capital i) 	Whether or not the date is in daylight saving time 	1 if Daylight Saving Time, 0 otherwise.
 O 	Difference to Greenwich time (GMT) in hours 	Example: +0200
 P 	Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3) 	Example: +02:00
 z 	Timezone abbreviation 	Examples: EST, MDT ...
 Z  Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.
 ----- Extra -----------------
 t : Short Identifier as a TC Date Example: TC
 T : Long Identifier as a TC Date Example: Thoth Count
 c : TC Count method Example: Long Count
 

@param arg a unix timestamp, if omitted defaults to the current time

@param method the String name of the TC Method, 'short' or 'long'
There are two methods of determining the 'Large Scale' time for the TC, one being that a Large Scale consists of 4 cycles of 9 4-year clusters (the 'Short Count' method) the other being that a Large Scale consists of 9 cycles of 9 4-year clusters. This means that a Large Scale is either 144 TC years (Short Count) or 324 TC Years (Long Count) and an Aleph would be then, either 144000 TC Years or 324000 TC Years

@return a formatted TC Date String

Example usage:

print "Now : ".tc_date()."<br>
Fully formatted: ".tc_date('\A\l\ep\h X, \L\ar\g\e S\c\a\l\e L, \in \t\h\e \c\y\c\l\e C, TY:d l g:i:s A \Coun\t M\e\t\ho\d: c');

--------- Ouput:
Now : TC16:07
Fully formatted: Aleph 1, Large Scale 1, in the cycle 4, Thoth Count16:07 Saturday 9:42:04 PM Count Method: Long Count