473,385 Members | 1,333 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,385 software developers and data experts.

Date 16 digit string need to pull data for last hour

Trying to pull data on what happened in the previous hour but date time is 16 digit string. (ex. 2020041609554089)
When I use date() in criteria , nothing is returned. I can use 2020041609* but I want to make auto report without keying in criteria. any help is appreciated. thank you.
Apr 17 '20 #1

✓ answered by cactusdata

You can convert that string to a true date value:

Expand|Select|Wrap|Line Numbers
  1. TrueDate: DateAdd("s", CInt(Val(Right([TextDate], 4)) / 100), CDate(Format(Left([TextDate], 12), "@@@@/@@/@@ @@:@@")))
This you can filter on the normal way, say:

Expand|Select|Wrap|Line Numbers
  1. Between DateAdd("h", -1, Now()) and Now()

5 2413
cactusdata
214 Expert 128KB
You can convert that string to a true date value:

Expand|Select|Wrap|Line Numbers
  1. TrueDate: DateAdd("s", CInt(Val(Right([TextDate], 4)) / 100), CDate(Format(Left([TextDate], 12), "@@@@/@@/@@ @@:@@")))
This you can filter on the normal way, say:

Expand|Select|Wrap|Line Numbers
  1. Between DateAdd("h", -1, Now()) and Now()
Apr 17 '20 #2
Got two errors. The first was a space after *4))_/100* which I deleted space. Then the "@@@@/@@.." was highlighted with error saying 'The expression you entered contains invalid syntax. you may have entered an operand without operator.'
I tried changing to:
TrueDate:DateAdd("s",CInt(Val(Right([Date],4))/100),CDate(Format(Left([Date],12),#yyyy/mm/dd hh:mm#)))
with and without " " around #s but got same error.
Apr 20 '20 #3
cactusdata
214 Expert 128KB
It runs here, of course, with no error, returning 2020-04-16 09:55:41.

Perhaps your provided sample differs from what you actually have.
Apr 20 '20 #4
Thank you for all your help. This finally worked after refreshing Referencing tool.
TrueDate:DateAdd("s",CInt(Val(Right([Date],4))/100),CDate(Format(Left([Date],12),"@@@@\/@@\/@@ @@\:@@")))
Apr 21 '20 #5
cactusdata
214 Expert 128KB
Great! Then please mark as answered.
Apr 22 '20 #6

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

Similar topics

2
by: Mark Jerzykowski | last post by:
Hi, I have a log table which contains the fields log_time (DATETIME) and session_id (VARCHAR). Using these 2 columns I want to be able to SELECT the number of users who have been online during...
5
by: cvillard | last post by:
I am new to SQL, as old as it is. I am not new to programming I normally just use Access. I have two tables for a little project manager I made. After updates I sent an email to the user. I need...
2
by: Jeremy Dillinger | last post by:
I have a program setup to pull data from a database. My database table has things such as (category, Item, price, etc.) In my program I want to have multiple list boxes that will have a pull down...
3
by: jjgardner3.web | last post by:
Hello I have a very simple xml file: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="./status.xsl"?> <IEC> <Workstation> <Hostname>HOSTNAME</Hostname>...
11
by: jwf | last post by:
I am writing a NON MFC C++ application (Plug-in for a 3rd party DB system). The application is designed to synchronise data between MS Outlook and the DB system. I am using smart pointers for the...
0
by: Ripendra007 | last post by:
hi all, i want to filter the date which is in label1.text like dview.RowFilter = "dir_bdate = '"+label1.Text+" '" ; here dir_bdate is my DateTime field of database and label1 contains string in...
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...
2
by: sunkesula | last post by:
I update a field in the database that gives the last update time. The first time I edit the item it puts a value in this field. The second time the applications fails with The statement has...
2
by: JM420A | last post by:
Access 2k3 Query: I have a string: DOE JOHN MICHAEL (last first middle) I need to pull JOHN out of it I can pull out DOE, and get the length of DOE, what I'm having trouble with is how...
3
by: lwc0724 | last post by:
I need to pull data based on anything >Date()-2 3:00pm How would I do this to input into a query?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.