473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

convert date stamp to previous date

56
7/19/2007 12:46:30 am. is in a field called CmplteDte. It is a date stamp of when the user completed the item. I need the time for a report but for a form that the supervisors use to QA the previous days work I format the date to 7/19/2007 using a query Format([CmplteDate],"mm/dd/yy") so that they see everything for that date and not just that time.

My questions is that when work is stamped after 12 midnight it date stamps to the next day, How do I convert these dates back to the previous date so that the date says 7/18/2007. The items are still the previous days work even though the user didn't complete the item until the next day. It would be from the time frame of 12:00 am to 4:00 am that needs to be converted back to the previous day.

Here is an example

7/19/2007 12:46:30 AM i want to formatt to 7/18/2007.
7/19/2007 1:18:52 AM I want to formatt to 7/18/2007
7/18/2007 8:59:49 AM formatted to 7/18/2007
7/18/2007 8:25:49 PM formatted to 7/18/2007
7/18/2007 8:15:55 PM formatted to 7/18/2007
7/18/2007 7:58:01 PM formatted to 7/18/2007
7/18/2007 7:42:10 PM formatted to 7/18/2007
Jul 19 '07 #1
2 2323
nico5038
3,080 Expert 2GB
Try to use as a field in your query:

Format([AanvraagDatum]-0,2000001;"yyyy-mm-dd") ' European setting with comma and semicolon as separator character

Format([AanvraagDatum]-0.2000001,"yyyy-mm-dd") ' US setting with dot as decial separator and comma as listseparator

As the time is reflected as a decimal fraction of the datenumber, you can subtract 0,2 to have a 4 hrs correction (24hrs=1day so 6 hrs = 0,2 day) I've added a very small fraction to include 4:00, but you can modify that when exactly 4:00 is excluded into 0,2

Nic;o)
Aug 1 '07 #2
cactusdata
214 Expert 128KB
I would just shift the recorded time by four hours:

Select *, DateAdd("h", -4, CmplteDte) As WorkDte From tblYourTable

To remove the time portion, apply Int:

Select *, Int(DateAdd("h", -4, CmplteDte)) As WorkDte From tblYourTable

/gustav

PS: Nico, is that you from EE?
Aug 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance,...
0
by: sumeet | last post by:
how do i convert a yyyymmdd format to yyyy,mm,dd format. also i want to know how do i get the number of days between two dates which r in the format yyyymmdd. how to convert date into unix time...
5
by: Des | last post by:
I have to do an events calender for a church. The events display will be limited to that week. If someone went in today Wed 24th I want to display 21st to 27th. I dont want any code samples, just...
2
by: k.roberts | last post by:
I'm not sure if this is possible or even practical to do, but I have a database which logs customer enquiries and has a field for the status of the enquiry i.e. Received, Approved, Job start, Job...
0
by: Wes Peters | last post by:
I have a situation where I want to filter records for a given day. The field that stores the date/time uses the date() function as a default value, kind of a date/time stamp for the record. The...
1
by: Wes Peters | last post by:
I have a situation where I want to filter records for a given day. The field that stores the date/time uses the date() function as a default value, kind of a date/time stamp for the record. The...
1
by: davelist | last post by:
I'm guessing there is an easy way to do this but I keep going around in circles in the documentation. I have a time stamp that looks like this (corresponding to UTC time): start_time =...
5
by: amanda27 | last post by:
I have a database that we use in our department for the status of our projects. In the form when you pick a project from the dropdown list I have a subform that pulls the data entered for the...
0
by: Jeroen Mostert | last post by:
Bruce wrote: Sure, hence my "easy to say after the fact" remark. Once you've got it wrong, you're usually stuck with it. But if that's the only problem, isn't it trivial for you to just ignore...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.