473,466 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Time and date Fixing

14 New Member
I have two field in database one for date and other for Time.I want to save data in 3rd field. My office timing is 04:00 PM to 03:00 AM. Suppose that today is 30th Nov, when i save data between 04:00 PM to 11:59 PM it will save in 30th nov but if i save after 12:00 am then it takes next date. My question is how can i save that data in same day i.e. 30 Nov.
Nov 30 '10 #1
4 1411
colintis
255 Contributor
If you are storing the date/time through VBA, you can use condition check and see if the time is between 12AM to 3AM
Expand|Select|Wrap|Line Numbers
  1. If Hour(<date>) >= 0 AND Hour(<date>) <=3 Then
  2.     DateAdd("d",-1,<date>)
  3. End If
Nov 30 '10 #2
Aditya jha
14 New Member
My query is: suppose today is 30 nov, if I save date in database before 11:59 PM it will save as 30th Nov but after 11:59 it save as next date. My office timing is 04:00 PM to 04:00 AM. So tell me how can i save date in between these timing.
Nov 30 '10 #3
colintis
255 Contributor
Its something similar too, but in queries we use IIF function
Expand|Select|Wrap|Line Numbers
  1. IIF(Hour(<date>)MOD 24 >= 3, DateAdd("d",-1,<date>),<date>)
This bit of function first check the if the hour contained in <date> is over 3 or not, which means the time between 12AM to 3AM. If it is true, then use DateAdd to take one day back (taking Dec 01 back to Nov 30). Otherwise it remains as what it is.

Also, can you post your query of what you've done so far?
Nov 30 '10 #4
Aditya jha
14 New Member
I have textbox on form. I want to input only numbers(0-9) and (.) from user. and if user input except these then cursor can't go to next object. if Textbox is blank then Tab works to goto next object. So please help me
Dec 2 '10 #5

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

Similar topics

13
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...
2
by: dave | last post by:
I have written asp code to insert current date and time. my database is in sql server 2000. this is the sql query that i m using. sql = "INSERT INTO tblDailyVisitLog...
1
by: Ria Van Heerden | last post by:
Hi How can I place the date and time that a form was displayed or submitted into a hidden form field and write that hidden field into my SQL database? I am using an ASP page with a MSSQL...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
7
by: Hieronimus | last post by:
Hi all I inherited a server running MySQL 4.* from a previous developer. Now, the records on this database might be what I want, or they might just be test data. I think my only chance of...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
3
by: colleen1980 | last post by:
Hi: Data in my table is in that format. How to i separate date with time. 11/9/2006 10:10:46 AM Thank You.
2
patjones
by: patjones | last post by:
Good afternoon all, This is one of those seemingly simple problems. I've searched through many posts here, and many people have date and time issues, but not quite what mine is. I've got a...
5
by: KusoYumi | last post by:
Hello, im facing date and time problem. I want get a time in Date Type, with this format HH:mm:SS i try to get new Date(), then format it as String. Then i use substring to get the time. Then i...
6
by: Geoff Cox | last post by:
Hello, at the moment I can add the combined date and time into MySQL using php $dt1 = date("Y-m-d H:i:s"); is it possible to add the date and time separately? I thought it might be
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...
1
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...
0
agi2029
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.