You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/sql.extensions/README.cast.format.md
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
## 1. DATETIME TO STRING
2
2
3
3
The following patterns are currently implemented for datetime to string conversion:
4
+
4
5
| Format Pattern | Description |
5
6
| -------------- | ----------- |
6
7
| YEAR | Year (1 - 9999) |
@@ -32,8 +33,9 @@ The following patterns are currently implemented for datetime to string conversi
32
33
| TZM | Time zone in Minutes (00 - 59) |
33
34
| TZR | Time zone Name |
34
35
35
-
The dividers are:
36
-
| Dividers |
36
+
The separators are:
37
+
38
+
| Separator |
37
39
| ------------- |
38
40
| . |
39
41
| / |
@@ -43,7 +45,7 @@ The dividers are:
43
45
| 'space' |
44
46
| - |
45
47
46
-
Patterns can be used without any dividers:
48
+
Patterns can be used without any separators:
47
49
```
48
50
SELECT CAST(CURRENT_TIMESTAMP AS VARCHAR(50) FORMAT 'YEARMMDD HH24MISS') FROM RDB$DATABASE;
49
51
=========================
@@ -53,6 +55,7 @@ However, be careful with patterns like `DDDDD`, it will be interpreted as `DDD`
53
55
54
56
It is possible to insert raw text into a format string with `""`: `... FORMAT '"Today is" DAY'` - Today is MONDAY. To add `"` in output raw string use `\"` (to print `\` use `\\`).
55
57
Also the format is case-insensitive, so `YYYY-MM` == `yyyy-mm`.
58
+
56
59
Example:
57
60
```
58
61
SELECT CAST(CURRENT_TIMESTAMP AS VARCHAR(45) FORMAT 'DD.MM.YEAR HH24:MI:SS "is" J "Julian day"') FROM RDB$DATABASE;
@@ -63,6 +66,7 @@ SELECT CAST(CURRENT_TIMESTAMP AS VARCHAR(45) FORMAT 'DD.MM.YEAR HH24:MI:SS "is"
63
66
## 2. STRING TO DATETIME
64
67
65
68
The following patterns are currently implemented for string to datetime conversion:
69
+
66
70
| Format Pattern | Description |
67
71
| ------------- | ------------- |
68
72
| YEAR | Year |
@@ -88,7 +92,7 @@ The following patterns are currently implemented for string to datetime conversi
88
92
| TZM | Time zone in Minutes (0 - 59) |
89
93
| TZR | Time zone Name or Time zone Displacement (same as TZH:TZM) |
90
94
91
-
Dividers are the same as for datetime to string conversion and can also be omitted.
95
+
Separators are the same as for datetime to string conversion and can also be omitted.
92
96
93
97
Year, month and day will be taken from current date if these components are not used in pattern (this applies only to data types that contain a date component).
0 commit comments