How to add time in timestamp

Discuss the database features
Post Reply
User avatar
mary jhane
Posts: 73
Joined: Sat Oct 22, 2011 6:27 am

How to add time in timestamp

Post by mary jhane »

hi,

i want to know if this is possible..

i had a timestamp of
12/29/11 03:20 PM
then i want to add 5 minutes breaktime
this will become
12/29/11 03:25 PM
OpenOffice 3.3 on Windows XP
eremmel
Posts: 1080
Joined: Tue Dec 30, 2008 1:15 am

Re: How to add time in timestamp

Post by eremmel »

Check the database SQL functions. E.g. TIMESTAMPADD() but likely not available in the build-in HSQLDB of Base.
or do you want to do it on a form? I'm not sure if you can use a e.g. spinner.
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
User avatar
mary jhane
Posts: 73
Joined: Sat Oct 22, 2011 6:27 am

Re: How to add time in timestamp

Post by mary jhane »

yes im using hsqldb 1.8,
how sad to hear that timestampadd is not available in hsqldb

what is spinner? is this available in hsqldb??
OpenOffice 3.3 on Windows XP
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: How to add time in timestamp

Post by RPG »

Hello

When you have the good defined fields then maybe this can help you.

Romke

Code: Select all

REM  *****  BASIC  *****
option explicit
Sub AddTime(oEvent as object)
' Bind to button
dim oButton
dim oForm
const sFieldName="tijd"
dim iIndex
dim TimeValue
oButton=oEvent.source.model
oForm=oButton.parent
iIndex= oForm.findcolumn(sFieldName)
select case "Datestruc"
	case "Datestruc"
		TimeValue=oForm.getTimestamp(iIndex)
		TimeValue.minutes=TimeValue.minutes+ 5 ' add 5 minutes
		oForm.updateTimestamp(iIndex,TimeValue)
	case "DatesDouble" ' wit a double value
		TimeValue=oForm.getdouble(iIndex)
		TimeValue=TimeValue+timeserial(0,5,0) ' add 5 minutes
		oForm.updatedouble(iIndex,TimeValue)
end select
End Sub
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
Post Reply