ddeshar/convertthaidate

A library to convert dates to Thai format

v1.0 2023-02-20 06:15 UTC

This package is auto-updated.

Last update: 2025-07-20 12:08:43 UTC


README

A simple library for converting dates to Thai date format and formatting elapsed time.

Installation

You can install the library using composer:

composer require ddeshar/thai-date-converter

Usage

namespace ddeshar\convertthaidate;

require_once __DIR__ . '/vendor/autoload.php';

use ddeshar\convertthaidate\ThaiDateConverter;

$date = '2022-12-31 12:00:00';
$thaiDate = ThaiDateConverter::convert($date, 'th', true, 'dd/mm/yyyy');
echo $thaiDate;

FormatTimeConverter

The FormatTimeConverter class provides two methods for converting time values:

  • format_time: Converts the given number of seconds into a formatted time string in the format of hh:mm.
  • time_ago: Converts a given timestamp into a human-readable string indicating the time elapsed since that timestamp.

For more information and usage examples, see the FormatTimeConverter User Manual.

ThaiDateConverter

The ThaiDateConverter class provides a method for converting a date string to Thai date format.

  • convert: Converts a date string to Thai date format.

For more information and usage examples, see the ThaiDateConverter User Manual.

User Manual

For detailed information on using this library, see the User Manual.

Downloads

You can download the latest version of the package from the releases page.