Skip to content

Commit 7b4de69

Browse files
authored
Update liquid.md
Time Range Using Epoch Timestamps, one example added where they can calculate a time range.
1 parent 7c4e3a7 commit 7b4de69

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/liquid.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,27 @@ By adding 86400 seconds to the string "now", before adding a date format, we get
6161
### Create an epoch Unix timestamp
6262
By using the string "now", and changing the date format to seconds, it will give you the epoch timestamp.
6363

64+
6465
**Expression:**
6566
```
6667
{{ "now" | date: "%s" }}
6768
```
6869

6970
**Result:**
70-
...
71+
```
7172
1643912690
72-
...
73+
```
74+
75+
Example 2: Calculate a Time Range Using Epoch Timestamps:
76+
You can use epoch timestamps to calculate a time range. For instance, you can use mathematical operations like subtraction or addition to find timestamps for a specific range (e.g., 10 days).
77+
```
78+
TimeFrom={{ "now" | date: "%s" | minus: 864000 }}&TimeTo={{ "now" | date: "%s" }}
79+
```
80+
**Result:**
81+
If the current timestamp is 1643912690, the generated values would be:
82+
```
83+
TimeFrom=1643048690&TimeTo=1643912690
84+
```
7385

7486
### Get size of an array
7587

0 commit comments

Comments
 (0)