Skip to content

Commit 8aca5f4

Browse files
committed
Correct Date and Time part in tutorial.html
1 parent 4bfd6f0 commit 8aca5f4

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

h2/src/docsrc/html/tutorial.html

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,30 +1359,35 @@ <h2 id="user_defined_variables">User-Defined Variables</h2>
13591359

13601360
<h2 id="date_time">Date and Time</h2>
13611361
<p>
1362-
Date, time and timestamp values support ISO 8601 formatting, including time zone:
1362+
Date, time and timestamp values support standard literals:
13631363
</p>
13641364
<pre>
1365-
CALL TIMESTAMP '2008-01-01 12:00:00+01:00';
1365+
VALUES (
1366+
DATE '2008-01-01',
1367+
TIME '12:00:00',
1368+
TIME WITH TIME ZONE '12:00:00+01:00',
1369+
TIMESTAMP '2008-01-01 12:00:00',
1370+
TIMESTAMP WITH TIME ZONE '2008-01-01 12:00:00+01:00'
1371+
);
13661372
</pre>
13671373
<p>
1368-
If the time zone is not set, the value is parsed using the current time zone setting of the system.
1369-
Date and time information is stored in H2 database files with or without time zone information depending on used data type.
1374+
ISO 8601-style datetime formats with T instead of space between date and time parts are also supported.
13701375
</p>
1371-
<ul>
1372-
<li>
1373-
With TIMESTAMP data type if the database is opened using another system time zone, the date and time will be the same.
1374-
That means if you store the value '2000-01-01 12:00:00' in one time zone, then close the database
1375-
and open the database again in a different time zone, you will also get '2000-01-01 12:00:00'.
1376-
Please note that changing the time zone after the H2 driver is loaded is not supported.
1377-
</li>
1378-
<li>
1379-
With TIMESTAMP WITH TIME ZONE data type time zone offset is stored and if you store the value
1380-
'2008-01-01 12:00:00+01:00' it remains the same even if you close and reopen the database with a different time zone.
1381-
If you store the value with specified time zone name like '2008-01-01 12:00:00 Europe/Berlin' this name will be
1382-
converted to time zone offset.
1376+
<p>
1377+
TIME and TIMESTAMP values are preserved without time zone information as local time.
1378+
That means if you store the value '2000-01-01 12:00:00' in one time zone, then change time zone of the session
1379+
you will also get '2000-01-01 12:00:00', the value will not be adjusted to the new time zone,
1380+
therefore its absolute value in UTC may be different.
1381+
</p>
1382+
<p>
1383+
TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE values preserve the specified time zone offset
1384+
and if you store the value '2008-01-01 12:00:00+01:00' it also remains the same
1385+
even if you change time zone of the session,
1386+
and because it has a time zone offset its absolute value in UTC will be the same.
1387+
TIMESTAMP WITH TIME ZONE values may be also specified with time zone name like '2008-01-01 12:00:00 Europe/Berlin'.
1388+
It that case this name will be converted into time zone offset.
13831389
Names of time zones are not stored.
1384-
</li>
1385-
</ul>
1390+
</p>
13861391

13871392
<h2 id="spring">Using Spring</h2>
13881393
<h3>Using the TCP Server</h3>

0 commit comments

Comments
 (0)