How to add time in timestamp

Discuss the database features

How to add time in timestamp

Postby mary jhane » Wed Jan 02, 2013 12:02 pm

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
User avatar
mary jhane
 
Posts: 73
Joined: Sat Oct 22, 2011 6:27 am

Re: How to add time in timestamp

Postby eremmel » Wed Jan 02, 2013 1:25 pm

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
eremmel
 
Posts: 1038
Joined: Tue Dec 30, 2008 1:15 am

Re: How to add time in timestamp

Postby mary jhane » Thu Jan 03, 2013 3:54 am

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
User avatar
mary jhane
 
Posts: 73
Joined: Sat Oct 22, 2011 6:27 am

Re: How to add time in timestamp

Postby RPG » Thu Jan 03, 2013 11:22 am

Hello

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

Romke

Code: Select all   Expand viewCollapse view
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 6.2.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2176
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands


Return to Base

Who is online

Users browsing this forum: No registered users and 7 guests