Hi All,
How can I convert the year contained in a timestamp to a string in order to update another field? Have experimented with the convert and substring function but to no avail
Thks
[Solved] Timestampdate to string or number
[Solved] Timestampdate to string or number
Last edited by gkick on Sat Dec 28, 2019 2:22 pm, edited 2 times in total.
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
Re: Timestampdate to string or number
Use the built-in function TO_CHAR or YEAR.
For Example Run the following Query:
I hope this helps, please be sure to let me / us know.
Sliderule
Thanks to add [Solved] in your 1st post Subject (edit button top right) if this issue has been resolved.
For Example Run the following Query:
Code: Select all
Select DISTINCT
CURRENT_TIMESTAMP as "CUR_TS",
YEAR(CURRENT_TIMESTAMP) as "INT_YEAR ", -- Returns an integer range 1-9999
TO_CHAR(CURRENT_TIMESTAMP,'YYYY') as "TO_CHAR", -- Returns text string
TO_CHAR( {TS '2027-12-28 15:30:27'},'YYYY') as "TO_CHAR_2027" -- Returns text string
From INFORMATION_SCHEMA.SYSTEM_TABLES
Sliderule
Thanks to add [Solved] in your 1st post Subject (edit button top right) if this issue has been resolved.
Re: Timestampdate to string or number
Beautiful, thank you Sliderule
GK
GK
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend