PHP Classes

OnTime Timezones and Formats Trait: Get formatted time and date in a given timezone

Recommend this page to a friend!
  Info   View files Example   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 52 All time: 10,499 This week: 88Up
Version License PHP version Categories
ontimedatetz 1.0.0Public Domain5PHP 5, Time and Date, Traits
Description 

Author

This package can get formatted time and date in a given timezone.

It provides several traits that can be use by any class to perform operations to return the time and the date considering a given timezone. Currently it can:

- Set the format to return dates and times
- Set timezone to consider for the time
- Get a given date and time displayed in the current format
- Validate dates and times

Picture of Mario Carrocera
  Performance   Level  
Name: Mario Carrocera is available for providing paid consulting. Contact Mario Carrocera .
Classes: 18 packages by
Country: Mexico Mexico
Age: 58
All time rank: 314536 in Mexico Mexico
Week rank: 568 Up8 in Mexico Mexico Up
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

Example

<?php

ini_set
('display_errors', true);
error_reporting(E_ERROR | E_PARSE | E_NOTICE | E_WARNING);

$base='ontime/';
$AdminPassword='OT2021Free';
include_once(
$base."OnTime.php");
$demo=new OnTime();
echo
"**********+++++++++++ <br> Basic Table Demo <br> **********+++++++++++ <br> <br>";
echo
"********** <br> Create Class <br> ********** <br> <br>";
$demo->ot_error('basic content exist').'<br>';
echo
"**********+++++++++++ <br> Conecting like admin <br> **********+++++++++++ <br> <br>";
echo
"Connect('admin','OT2021Free') ";
$demo->Connect('admin',$AdminPassword);
echo
"<br>";$demo->ot_error("Connected!!!");echo "<br>";
echo
"**********+++++++++++ <br> Date information <br> **********+++++++++++ <br> <br>";
echo
"********** <br> Time Zones <br> ********** <br> <br>";
echo
"ShwCntIn('TimeZone','date') ";
$demo->ot_show($demo->ShwCntIn('TimeZone','date'));
echo
"********** <br> Formats <br> ********** <br> <br>";
echo
"ShwCntIn('PhpFormat','date')";
$demo->ot_show($demo->ShwCntIn('PhpFormat','date'));
echo
"********** <br> Now <br> ********** <br> <br>";
echo
"Now() <br>";
echo
$demo->Now();
echo
"<br> ********** <br> Now in tz<br> ********** <br> <br>";
echo
"Nowin('Asia/Tokyo') <br>";
echo
$demo->Nowin('Asia/Tokyo');
echo
"<br> ********** <br> Clock <br> ********** <br> <br>";
echo
"Clock() <br>";
echo
$demo->Clock();
echo
"<br> ********** <br> Clock with format <br> ********** <br> <br>";
echo
"<Clock('H:i') <br>";
echo
$demo->Clock('H:i');
echo
"<br> ********** <br> Clock timezone in madrid <br> ********** <br> <br>";
echo
"<br> ClockIn('Europe/Madrid','H:i P') <br>";
echo
$demo->ClockIn('Europe/Madrid','h:i A P');
echo
"<br> ********** <br> Current Date Time like object <br> ********** <br> <br>";
echo
'<br> $now=$demo->Date() <br>';
$now=$demo->date();
echo
'<br> echo $now->format("l d F Y H:i:s a e") <br>';
echo
$now->format("l d/F/Y H:i:s a e").'<br>';
echo
"<br> ********** <br> Set date from string <br> ********** <br> <br>";
echo
"DatStr('20210229') <br>";
echo
$demo->DatStr('20210229');
echo
"<br>";$demo->ot_error("fecha ok!!!");echo "<br>";
echo
"DatStr('20210226') <br>";
echo
$demo->DatStr('20210229');
echo
"<br>";$demo->ot_error("fecha ok!!!");echo "<br>";
echo
"<br> ********** <br> Set date from string like object<br> ********** <br> <br>";
echo
"DatObj('20210228') <br>";
$now = $demo->DatObj('20210228');

echo
"**********+++++++++++ <br> Set up Date Format & Time zone <br> **********+++++++++++ <br> <br>";
echo
"<br> ********** <br> Time Zone for System <br> ********** <br> <br>";
echo
'<br> SetSysTz("America/Mexico_City") <br>';
$demo->SetSysTz("America/Mexico_City");
echo
"<br>";$demo->ot_error("Asigned!!!");echo "<br>";
echo
"<br> ********** <br> Date Time format for System <br> ********** <br> <br>";
echo
'<br> SetSysFmt("RFC850") <br>';
$demo->SetSysFmt("RFC850");
echo
"<br>";$demo->ot_error("Asigned!!!");echo "<br>";

echo
"<br> ********** <br> Time Zone for My user <br> ********** <br> <br>";
echo
'<br> SetMyTz("Europe/Madrid") <br>';
$demo->SetMyTz("Europe/Madrid");
echo
"<br>";$demo->ot_error("Asigned!!!");echo "<br>";
echo
"<br> ********** <br> Date Time format for My User <br> ********** <br> <br>";
echo
'<br> SetMyFmt("ATOM") <br>';
$demo->SetMyFmt("ATOM");
echo
"<br>";$demo->ot_error("Asigned!!!");echo "<br>";

echo
"<br> ********** <br> Time Zone for an user <br> ********** <br> <br>";
echo
'<br> SetUsrTz("America/Monterrey") <br>';
$demo->SetUsrTz("America/Monterrey",'Admin');
echo
"<br>";$demo->ot_error("Asigned!!!");echo "<br>";
echo
"<br> ********** <br> Date Time format for an User <br> ********** <br> <br>";
echo
'<br> SetUsrFmt("COOKIE") <br>';
$demo->SetUsrFmt("COOKIE",'Admin');
echo
"<br>";$demo->ot_error("Asigned!!!");echo "<br>";


echo
"**********+++++++++++ <br> Validations <br> **********+++++++++++ <br> <br>";
echo
"<br> ********** <br> date <br> ********** <br> <br>";
echo
'<br> DatVal("20190229") <br>';
$demo->DatVal("20190229");
echo
"<br>";$demo->ot_error("Date OK!!!");echo "<br>";
echo
'<br> DatVal("19650822") <br>';
$demo->DatVal("19650822");
echo
"<br>";$demo->ot_error("Date OK!!!");echo "<br>";
echo
"<br> ********** <br> Time <br> ********** <br> <br>";
echo
'<br> TmeVal("136102") <br>';
$demo->TmeVal("136102");
echo
"<br>";$demo->ot_error("Time OK!!!");echo "<br>";
echo
'<br> TmeVal("082200") <br>';
$demo->TmeVal("082200");
echo
"<br>";$demo->ot_error("Time OK!!!");echo "<br>";
echo
"<br> ********** <br> Date Time <br> ********** <br> <br>";
echo
'<br> DatTmeVal("19650822136102") <br>';
$demo->DatTmeVal("19650822136102");
echo
"<br>";$demo->ot_error("Time OK!!!");echo "<br>";
echo
'<br> DatTmeVal("01965082282200") <br>';
$demo->DatTmeVal("19650822082200");
echo
"<br>";$demo->ot_error("Time OK!!!");echo "<br>";



echo
"<br>**********+++++++++++ <br> Demo Finish<br> **********+++++++++++ <br> <br>";
?>


  Files folder image Files  
File Role Description
Accessible without login Plain text file DemoDate.php Example Example script
Accessible without login Plain text file licencia Data Auxiliary data
Accessible without login Plain text file license Lic. License text
Plain text file OnTime.php Class Class source
Plain text file OnTimeAllways.php Class Class source
Plain text file OnTimeContent.php Class Class source
Plain text file OnTimeDateA.php Class Class source
Plain text file OnTimeDateB.php Class Class source
Plain text file OnTimeFunctions.php Class Class source
Accessible without login Plain text file OntimeInstallerDate.php Example Example script
Plain text file OnTimetmp.php Class Class source
Plain text file OTidate.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

Downloadontimedatetz-2021-04-07.zip 17KB
Downloadontimedatetz-2021-04-07.tar.gz 14KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
OnTime Basic Content Trait Backend Download .zip .tar.gz Time zones and Formats is stored in this format Required
OnTime Core Backend Download .zip .tar.gz Core is tha main class of the framerok Required
HTML Nav bar using PHP on Time Download .zip .tar.gz Implements a Nav Bar Optional
HTML LayOut using PHP on Time Download .zip .tar.gz Implement Layout Optional
HTML CSS Styles using PHP on Time Download .zip .tar.gz Implements Css Html Optional
HTML Google Fonts using PHP on Time Download .zip .tar.gz Implement Google Font on HTML Optional
HTML Metatags using PHP on Time Download .zip .tar.gz Html Meta Tag pacakage Optional
OnTime PHP Multi Language trait Download .zip .tar.gz Add Multilenguage to the database Optional
Easy PHP SOAP Server Web Service Download .zip .tar.gz Add soap webservice server Optional
OnTime Table Trait Download .zip .tar.gz Add table feature with myltiple fields validatied Optional
On Time Data Dictionary and Record Trait Download .zip .tar.gz Add Data Dictuionary and record information Optional
OnTime Debugger Backend Trait Download .zip .tar.gz The Debugger is very useful to trace Optional
HTML Include Images and Text using PHP on Time Download .zip .tar.gz Implement image & text Optional
OnTime Group Backend Download .zip .tar.gz The best practice, manege the safety like group Recommended
 Version Control Reuses Unique User Downloads Download Rankings  
 100%8
Total:52
This week:0
All time:10,499
This week:88Up