aboutsummaryrefslogtreecommitdiff
path: root/docs/datetime.md
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-29 20:23:00 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-29 20:23:00 -0400
commitbd54e51a85003bb5eea3f98d243b8ddc29df3b0a (patch)
tree48c91ea9a95572d6a8735d7631948c462b81b39e /docs/datetime.md
parent076f87361dd4bb6fcafbe5468353dfa7804d3636 (diff)
Update docs
Diffstat (limited to 'docs/datetime.md')
-rw-r--r--docs/datetime.md39
1 files changed, 33 insertions, 6 deletions
diff --git a/docs/datetime.md b/docs/datetime.md
index 24215862..9906fc9e 100644
--- a/docs/datetime.md
+++ b/docs/datetime.md
@@ -70,7 +70,7 @@ A new `DateTime` offset by the given amount.
**Example:**
```markdown
->> DateTime.new(2024, 9, 29, hour=19):after(days=1, minutes=30)
+>> DateTime(2024, 9, 29, hour=19):after(days=1, minutes=30)
= Mon Sep 30 19:30:00 2024
```
@@ -96,7 +96,7 @@ The date in `YYYY-MM-DD` format.
**Example:**
```markdown
->> DateTime.new(2024, 9, 29):format("%A")
+>> DateTime(2024, 9, 29):format("%A")
= "2024-09-29"
```
@@ -125,7 +125,7 @@ Nothing.
**Example:**
```markdown
->> DateTime.new(2024, 9, 29):format("%A")
+>> DateTime(2024, 9, 29):format("%A")
= "Sunday"
```
@@ -186,7 +186,7 @@ Nothing.
**Example:**
```markdown
-dt := DateTime.new(2024, 9, 29)
+dt := DateTime(2024, 9, 29)
month := 0
dt:get(month=&month)
>> month
@@ -251,7 +251,8 @@ the_future := now():after(minutes=1, seconds=30)
**Description:**
Return a new `DateTime` object representing the given time parameters expressed
-in local time.
+in local time. This function is the same as calling `DateTime` directly as a
+constructor.
**Usage:**
```markdown
@@ -282,6 +283,32 @@ integer, an error will be raised.
---
+### `now`
+
+**Description:**
+Get a `DateTime` object representing the current date and time. This function
+is the same as the global function `now()`.
+
+**Usage:**
+```markdown
+DateTime.now() -> DateTime
+```
+
+**Parameters:**
+
+None.
+
+**Returns:**
+Returns a `DateTime` object representing the current date and time.
+
+**Example:**
+```markdown
+>> DateTime.now()
+= Sun Sep 29 20:22:48 2024
+```
+
+---
+
### `parse`
**Description:**
@@ -396,7 +423,7 @@ A text representation of the time component of the datetime.
**Example:**
```markdown
-dt := DateTime.new(2024, 9, 29, hours=13, minutes=59, seconds=30)
+dt := DateTime(2024, 9, 29, hours=13, minutes=59, seconds=30)
>> dt:time()
= "1:59pm"