User Tools

Site Tools


syntax:functions:date

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
syntax:functions:date [2021/08/29 23:55] craigtsyntax:functions:date [2023/11/24 21:06] (current) – [Examples] craigt
Line 13: Line 13:
 =====Arguments===== =====Arguments=====
 ^Argument^Type^Description^ ^Argument^Type^Description^
-|datetime  |Text  |A text value representing a date and/or time value.| +|datetime  |Text  |A text value representing a date and/or time value to be converted to a numeric date-time serial value.| 
-|format  |Text  |The layout of the date-time components  in //datetime// describing the order and type of components.  See the "Date-Time format components" tables below.|+|format  |Text  |(Optional) The layout of the date-time components in //datetime// describing the order and type of the date-time components. If omitted, EasyMorph will attempt to detect the date format automatically. See the "Date-Time format components" tables below.|
  
 **Return value type:** Number (date-time serial value). **Return value type:** Number (date-time serial value).
  
 \\  \\ 
-==== Date-Time format components ==== +==== Date-Time format string components ==== 
-The specifiers below are case-sensitive.+A //format string// defines a formatting template for dates and times. Its components can be put together in any combination. If a character doesn't belong to a format component then it's inserted verbatim. 
 + 
 +The specifiers below are case-sensitive :!:.
 ^  Date format specifier^  Description  ^ ^  Date format specifier^  Description  ^
 |  d  |The day of the month, from 1 through 31.  | |  d  |The day of the month, from 1 through 31.  |
Line 54: Line 56:
 If a time value is used for the //datetime// argument, the return value will use today's date for the date component. If a time value is used for the //datetime// argument, the return value will use today's date for the date component.
  
 +While it can be convenient, in some cases, to omit the //format//, it is recommended to specify the date format explicitly, when possible, to ensure deterministic behavior.
 \\  \\ 
 =====Examples===== =====Examples=====
Line 65: Line 68:
  
   date('20140101','yy-MM-dd') //Returns #Can't convert to date (Invalid format)   date('20140101','yy-MM-dd') //Returns #Can't convert to date (Invalid format)
 +
 +  date('2023-Nov-4') //(Omitted format) Returns 45234
 +  
  
 \\  \\ 
syntax/functions/date.txt · Last modified: 2023/11/24 21:06 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki