Page 1 of 1

How to add time in timestamp

Posted: Wed Jan 02, 2013 12:02 pm
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

Re: How to add time in timestamp

Posted: Wed Jan 02, 2013 1:25 pm
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.

Re: How to add time in timestamp

Posted: Thu Jan 03, 2013 3:54 am
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??

Re: How to add time in timestamp

Posted: Thu Jan 03, 2013 11:22 am
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