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

Keeping a date as UK when updating through SQL

I'm using a VB backend to add and update records to a database via SQL, but the dates are changed to US format when I need them in UK format.

How can I make it so that either they're stored as UK times, or the US time is displayed as UK and reports and queries that are trying to parse them for month properties function correctly?

The other problem is that if the date inputted is the 28/07/2007, for example, it will keep it in that format, but if the date inputted is the 01/07/2007 then the date stored is 07/01/2007, so I can't just display the date differently and tell reports to look at dd rather than mm and just pretend it's all ok, because for half the month it won't be ok.

Thanks in advance!
Jun 3 '07 #1
2 1465
FishVal
2,653 Expert 2GB
I've been fighting with this too.
From my experience Jet SQL accepts date in american format only.
You should write code to convert you date to american format before passing it to SQL query.

Something like this.

Public Function SQLDate(varInput As Variant) As String

If IsNull(varInput) Then
SQLDate = ""
Else
SQLDate = "#" & Month(varInput) & "/" & _
Day(varInput) & "/" & Year(varInput) & "#"
End If

End Function

Good luck.
Jun 3 '07 #2
The problem was that I didn't discover this until recently because I'd been making the database and testing it at the backend of last month, so the dates were being passed correctly.

Because it was a very late stage I instead opted to have three input boxes for day/month/year and to store them as such.

I then remade my queries so that the old Date field used the same name but consisted of [Day]+"/"+[Month]+"/"+[Year] meaning the system still functioned and I didn't have to spend ages trying to rework the entire thing.

Thanks for the help though, I'm sure it'll be useful in the future!
Jun 3 '07 #3

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

Similar topics

6
by: Michael Bulatovich | last post by:
I have a very simple db I use for keeping track of hours, tasks, projects, clients etc. It has a form that I use to enter data. Currently the form has a textbox for a field called "start time",...
1
by: marty.overdear | last post by:
>NET 2003, vb code behind. I am having a problem with the look of a page with a datagrid. I have the grid populated, and it can be a couple of hundred rows long. If the user is down toward the...
2
by: Colli | last post by:
Hi: I need to setup a continuously updating system Date/Time in my user interface. I can get the system date/time and can cause it to update with a button-click but I can't seem to figure out how...
7
by: David Lozzi | last post by:
Howdy, I have a usercontrol in my aspx page and when the page loads, I send it some property values based on the data displayed. I am sending it to a public property like below. However the...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
7
by: lmnorms1 | last post by:
Hello, I am trying to update an access database record date field that matches a specific date. The code is not working. Anyone have any advice? Here is the code: Dim gConnString As String =...
0
by: oneplace | last post by:
I have the following script that use for the following after i have made my search for a name in my database. I select the name and it bring up this from with all the information of the person. It...
1
by: Zelalem | last post by:
Hi sir , Last time I came up with a question about keeping the orginal database after updating,editing and deleting will be done. Here what I want to inform you is that the...
1
by: EyeHawk | last post by:
OK, hopefully somebody can help me out again. My next problem is updating 3 form fields (type list/menu option) that correspond to a date, one for month, one for day and one for year when the user...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
marktang
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,...
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
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...

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.