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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing and calculating current time 1

Status
Not open for further replies.

mutley1

MIS
Jul 24, 2003
909
OK, I give up. Googled all over the place and can't find a simple answer so hoping the experts can help me out here.

trying to create a simple table of state codes, time difference and current time.

In a SQL table, I have:

StateCode - e.g. NY
StateName - New York
StateTimeDiff - 3 (i.e. 3 hours ahead)
CurrentTime - Calculated value (convert(varchar,dateadd(hour,[StateTimeDiff],getdate()),108))

So if I select the state and current time, it is already there as a calculated field.

In access, can I store it as current time minus the amount in a diffierent field, or do I need to do that calc in a select statement on the form I am trying to create?

Thanks,

M.
 
Calculations are always best created on your form. Its not good practise to store totals.


HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
Thanks Maze,

Whats the access syntax for current time plus X hours as i cant get that to work either....
 
= DateAdd("h", 3, Format(Now(), "hh:mm:ss AMPM"))

Format(Now(), "hh:mm:ss AMPM") is simply the time now formatted we use the DateAdd function to add in this case hours(3) to the current time. Your could refrence a control to get your desired interval

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top