Knowledgebase



 Categories





 Dimofinf Mobile


Subscribe now to Dimofinf Mobile and enjoy a wide range of premium services. You will receive our SMS text messages wherever you are for a very low cost! More


 Currency Converter


  • Currency
  • US$ Amount

Numbers and dates functions



  • DIM_date($format, $timestamp = TIMENOW, $doyestoday = false, $datemethod ="", $adjust = true, $gmdate = false)

This function is used to return the date in the desired form or according to the time and date form in the Dimofinf settings.

Parameters:

      -  
$format (mandatory): the desired time format.
      -  $timestamp (optional): time in the Time Stamp format.
      -  $doyestoday (optional): the value 'boolean true/false', when activated,
             the time format will be for example "Yesterday, 12pm" instead of the full time format.
      -  $datemethod (optional): used to control whether to display Hijri or Gregorian months names.
      -  $adjust (optional): the value 'boolean true/false', when activated, displays
             the date with respect to time differences.
      -  $gmdate (optional): the value 'boolean true/false' is used to display time in the form of GMT/UTC.

Example:

PHP :
{* php buffer start *} DIM_date($dimofinf->options['dateformat'], $row['date'], 1) 
{* php buffer end *}

  • build_assign_datetime($time = TIMENOW, $abbr ="", $incy = 0, $incm = 0, $incd = 0, $addyear = true, $addmonth = true, $addday = true, $addhour = true, $addminute = true)

This function is for drawing blocks of several 'select' menus of minutes, hours, days, months and years. This is used for example when adding or editing the content to determine the publishing and ending date for the content.

Parameters:

      -  
$time (optional): time in the Time Stamp format.
      -  $abbr (optional): this parameter allows an abbreviation in the block name within the template
             if the block name is called 'year' and this parameter was set to 'p' then the block name becomes
             'pyear' and this helps if you want to avoid conflicts with block names.
      -  $incy (optional): the increase rate per year. If you want the next year to be the default in the menu
             then add '1' but if you want the current year to be the default then leave the default set to 'current'.
      -  $incm (optional): the increase rate per month. If you want the next month to be the default in the menu
             then add '1' but if you want the current month to be the default then leave the default set to 'current'.
      -  $incd (optional): the increase rate per day. If you want the next day to be the default in the menu then
             add '1' but if you want the current day to be the default then leave the default set to 'current'.
      -  $addyear (optional): the value 'boolean true/false' is used to show the 'select' menu for years.
      -  $addmonth (optional): the value 'boolean true/false' is used to show the 'select' menu for months.
      -  $addday (optional): the value 'boolean true/false' is used to show the 'select' menu for days.
      -  $addhour (optional): the value 'boolean true/false' is used to show the 'select' menu for hours.
      -  $addminute (optional): the value 'boolean true/false' is used to show the 'select' menu for minutes.

Example:

In the template:

CODE :
 {phrase_year}<select name="pyear"><[START BLOCK : pyear]&gt;<option value="{year}">{year}</option><[END BLOCK : pyear]&gt;</select> {phrase_month}<select name="pmonth"><[START BLOCK : pmonth]&gt;<option value="{month}">{month}</option><[END BLOCK : pmonth]&gt;</select> {phrase_day}<select name="pday"><[START BLOCK : pday]&gt;<option value="{day}">{day}</option><[END BLOCK : pday]&gt;</select> {phrase_hour}<select name="phour"><[START BLOCK : phour]&gt;<option value="{hour}">{hour}</option><[END BLOCK : phour]&gt;</select> {phrase_minute}<select name="pminute"><[START BLOCK : pminute]&gt;<option value="{minute}">{minute}</option><[END BLOCK : pminute]&gt;</select


In the PHP file:

PHP :
{* php buffer start *} build_assign_datetime(TIMENOW,"", 0, 1);
build_assign_datetime(
$row[&#039;date'],"p"); 
{* php buffer end *}

  • dim_number_format($number, $decimals = 0, $bytesize = false)

This function is used to return the number after setting decimal and thousands commas according to the settings of the main language in Dimofinf settings.

Parameters:

      -  
$number (mandatory): the number you would like to format.
      -  $decimals (optional): to activate decimal commas, add '1'.
      -  $bytesize (optional): the value 'boolean true/false', when activated, it will be
             returned in the form of Terabytes/Gigabytes/Megabytes/Kilobytes/Bytes.

Example:

PHP :
{* php buffer start *} $msize dim_number_format($row[&#039;dlink'][$i]['size'], 1, true); 
{* php buffer end *}


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Files functions (Views: 499)

file_extension($filename)This function is used to return the file extension.Parameters: ...


User functions (Views: 480)

verify_id($idname, &$id, $alert = true, $selall = false, $options = 0)This function is used...


Content functions (Views: 440)

recursive($dynamic_cat_id,$module,$rate)This function is important and should be added at the end...


General functions (Views: 497)

Dimofinf appreciates your time and so, we offer you a selection of ready functions and constants...


Editor functions (Views: 431)

Dim_editor($area, $text ="", $rows = 26, $showresize = false, $dimcp = false, $editor_id = 0,...



Online