I am trying to take standard MS Time:
2/22/2006 8:56:37 AM (stored in MS Decimal Format)
and convert it to the half hour of the day it occurred in:
2/22/2006 8:56:37 AM would be in the 18th half hour of the day (48 in
all).
Anyone know of a way to do this within a query?
I have tried this:
Fix(0.999999+(T ime()-[TimeField])*24)
and all it returns is the actual half hour of the year, I believe.
Thanks in advance,
Dave 2 2864
Add this function to a standard Access Code module.
Function getHalfHour(d1 As Date) As Integer
Dim d2 As Date
d2 = Format(d1, "Short Date")
getHalfHour = CInt((DateDiff( "n", d2, d1)) / 30)
End Function
Then, in your query you can use it like this:
SELECT gethalfhour(you rDatefld) AS d1
FROM yourTable;
In the Access Query Builder just specify:
d1:getHalfHour( yourDatefld)
in the query field.
This will return 18 for the half hour for
#2/22/06 8:56:37 AM#
Rich
Rich
*** Sent via Developersdex http://www.developersdex.com ***
It may be easiest to set up a lookup table with the 48 entries. It would
have 2 columns, the first column would have 1 through 48, the second would
have the times of each half hour. You would then find the value in column 1
associated with the maximum value in column 2 that is equal to or less than
the time you are testing.
Example:
DLookup("Field1 ", "tblHalfHourLoo kup", "Field2 = #" & DMax(""Field2"" ,
""tblHalfHourLo okup"", ""Field2<= #"" & [TimeField] & ""#"") & "#")
--
Wayne Morgan
MS Access MVP
<sp***********@ gmail.com> wrote in message
news:11******** *************@p 10g2000cwp.goog legroups.com... I am trying to take standard MS Time:
2/22/2006 8:56:37 AM (stored in MS Decimal Format)
and convert it to the half hour of the day it occurred in:
2/22/2006 8:56:37 AM would be in the 18th half hour of the day (48 in all).
Anyone know of a way to do this within a query?
I have tried this:
Fix(0.999999+(T ime()-[TimeField])*24)
and all it returns is the actual half hour of the year, I believe.
Thanks in advance,
Dave This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: perplexed |
last post by:
How do you convert a user inputted date to a unix timestamp before
insterting it into your database? I have a form, with a textfield for
a date that the user inputs in the format mm-dd-yyyy and three dropdow
boxes for hours, minutes, and AM/PM. All of these need to be considered
together and converted to one Unix Timestamp and then inserted to the
MYSQL date field. The type of field is INT (11) so that I can instead
of the standard...
|
by: Benoit BESSE |
last post by:
Hi, I try to write a fonction which take a date and time and convert it into
a NTP time.
I have to use mktime but I did not work at all.
Here is my code dans the exécution.
Please help.
Thanks
def ToNTPTime(d,h):
"Retuen a NTP time"
year,month,day=d.split("/")
|
by: James P. |
last post by:
Hello,
In my Access report, I have a minutes field in the detail line. How
do I convert that minute to hour and minute. The problem for me now
is if I take the minutes, say 75 divide by 60, it gives me 1.25; or
90/60 = 1.50. These are not what the user wants.
They want to have hour and minutes, say 75 minutes, needs to convert
to 1.15 (1 hour 15 minutes); or 90 minutes to 1.30, and so on.
|
by: ECVerify.com |
last post by:
I am trying to convert a computers local time to Pacific time, I can
get it back to UTC pretty easy but I actually want to convert whatever
the local time is on the computer I want to calculate what it would
currently be in Pacific time. Taking in account Daylight Savings Time
Thanks, Ed,
|
by: yxq |
last post by:
Hello,
I found there are some date formats in the email header,
for example:
Fri, 23 Sep 2005 08:51:56 +0800
Sat, 17 Sep 2005 09:08:07
Wed Oct 19 13:40:23 2005
19 Oct 2005 13:40:23 +0000
19 Oct 2005 13:40:23 -0400
| |
by: Michael Barrido |
last post by:
I have this for example:
Dim iSeconds as int32 = 3600 '3600 seconds is one hour
How do i convert it to "01:00:00" ? Please help.
Thanks in advance!
|
by: Laguna |
last post by:
Hi,
I have an XML file in a single long string. How can I convert it into
the nicely indented format as displayed by Internet Explorer using
Python?
Thanks,
Laguna
Input XML file (one continuous string without newline):
|
by: msosno01 |
last post by:
I have Java client that connects to C++ server. The client sends
integer in binary using DataOutputStream write function. I am reading
these data into buffer. I have to convert this buffer back into
integer, but I am not sure how to do it.
This is my code:
int32_t var1;
uint8_t buf;
|
by: sebasC |
last post by:
the code below is used on a site to show time in multiple time zones on the website what i need is to convert the php code below to asp so that it will work. because the clock shows on the site but does not update. I included the javascript to help to illustrate how the code interacts to create the time displayed
<?
$timers = Array("New York"=>-5,
"London"=>0,
"Tokyo"=>9,
"Sao Paulo"=>-3,
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |