Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the value of a time 1

Status
Not open for further replies.

gscheepers

IS-IT--Management
Jan 21, 2002
150
US
I would like to change the value of a time. Say for instance the value is 08:00, how can I change it to be 09:00 without changing the value in the database itself?

Thanks Gerhard Scheepers
BA - LETEC
 
Hi !
If it is a DateTime field and you have the function DateAdd,
you can make a formula like this:

DateAdd ("h", 1,{DateTime field} )

/goran
 
Hi!

Thanks, but the field is a Time only field. Any idea to what I can do? Gerhard Scheepers
BA - LETEC
 
Hi again !
Maybe there is another way,
but I think this will work.

In your formula you write:
YourTimeField + 3600

/goran
 
Thanks! This works great on adding an hour to each value, but my problem stretches a bit further that that. I don't want each value to increase by an hour after 9:00. It should only increase the value up until the value is equal to 9:00.

So in other words everything less that 9:00. Gerhard Scheepers
BA - LETEC
 
Ok !
Can this formula solve your problem ?

if YourTimeField + 3600 < TimeValue (09,00 ,00 ) then
YourTimeField + 3600
else
YourTimeField

/goran
 
Thanks!

It almost looks like it's going to work, but it doesn't change the value if I use it like this:

if {@TimeFromNum} + 3600 < TimeValue (09,00,00) then
{@TimeFromNum} + 3600
else
{@TimeFromNum}

It changes when I use it like this, but it's not the right value:

if {@TimeFromNum} + 3600 > TimeValue (09,00,00) then
{@TimeFromNum} + 3600
else
{@TimeFromNum}
Gerhard Scheepers
BA - LETEC
 

Can you give me an example of how the {@TimeFromNum} field
looks like.
Another question: If the time value is 08:40 would you
like to have it as it is or changed to 09:00 ?

/goran
 
If i'm reading your post correctly, you want any time before 9am to be displayed as 9am and any time after that to be displayed as the actual time. If that is correct, the following formula will accomplish that for you.


If {@TimeFromNum} < time(09,00,00)
then time(09,00,00) else
{@TimeFromNum} Mike

 
Thanks Goran and Mike for all your help! I finally got it to work with Mike's formula! Gerhard Scheepers
BA - LETEC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top