Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Microsoft Office и VBA программирование > Microsoft Office Access
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 21.10.2015, 15:16   #1
Cap7
Пользователь
 
Регистрация: 16.06.2015
Сообщений: 15
По умолчанию MS Access 2010 Вопрос по вычислениями с датами

Надо создать простую таблицу, заезда машин на территорию предприятия, 1-я колонка "везд автомашины" и 2-я колонка "Выезд автомашины" и 3-я колонка "время нахождения на територии" .В колонки должна вносится информация с датой и временем заезда и выезда автомашин и разницу между колонок(3-я колонка) надо получить в часах. Помогите !!!!
Cap7 вне форума Ответить с цитированием
Старый 21.10.2015, 15:32   #2
AleksandrH
Форумчанин
 
Аватар для AleksandrH
 
Регистрация: 15.02.2010
Сообщений: 148
По умолчанию

Цитата:
Use DateDiff() to calculate the elapsed time. It returns whole numbers only, so if you want hours and fractions of an hour, you must work in minutes. If you want minutes and seconds, you must get the difference in seconds.

Let's assume a date/time field named StartDateTime to record when the employee clocks on, and another named EndDateTime for when the employee clocks off. To calculate the time worked, create a query into this table, and type this into the Field row of the query design grid:

Minutes: DateDiff("n", [StartDateTime], [EndDateTime])

Minutes is the alias for the calculated field; you could use any name you like. You must use "n" for DateDiff() to return minutes: "m" returns months.

To display this value as hours and minutes on your report, use a text box with this Control Source:

=[Minutes] \ 60 & Format([Minutes] Mod 60, "\:00")

This formula uses:

the integer division operator (\) rather than regular division (/), for whole hours only;
the Mod operator to get the left over minutes after dividing by 60;
the Format() function to display the minutes as two digits with a literal colon.

Do not use the formula directly in the query if you wish to sum the time; the value it generates is just a piece of text.
http://allenbrowne.com/casu-13.html
WIX-FILTERS. A Filter for every application.
AleksandrH вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Вопрос по работе с датами и временем! Cap7 Microsoft Office Access 0 23.06.2015 13:39
Переписывание файла adp под Access 2007 или Access 2010 Анатолий_2014 Microsoft Office Access 1 02.09.2014 20:12
работа с периодами и датами, вопрос по оптимизации RusikOk SQL, базы данных 2 02.08.2014 01:40
Операции с датами в Access 2003 Elvisnya Microsoft Office Access 9 17.01.2012 11:21
Запрос с датами и временем к Access [D7, Access] alexandr2010 БД в Delphi 3 26.07.2010 22:19