I have access 2003
For uploading the Date of Birth from my Access DataBase to my gmail account, I need the notation yyyy-mm-dd in my table.
However, for calculating the age in Access, I need to rotate this notation to dd-mm-yyyy
There is no need to store this roated DoB in my table, but I can make an extra field if it can be stored in the table.(But I do not know if this is possible).
So I need a query that does the notation rotate for me, wherafter I can calculate the exact age with Age:(Date()-([DoB]/ 365,25
Who can help me to rotate the DoB notation.
Thanks in Advance
Peter
7 7892
Hi Peter,
You don't have to change anything in table. Just create a query and select your DoB field. Right click on the this selected field and click 'Properties'. In properties window, go to 'General' tab and go to 'Format'. Just type yyyy-mm-dd over there in the format section.
Remember: You have to check whether you want "-" or "." or "/" in between yyyy mm dd, and type accordingly.
And thats all.!
Run the query, You'll see the desired result.
Hi Narender.
I tried your suggestion, but I can't get it work.
I created a query with Colomn "Name" and Colomn "Birthdate"
Both fields are in my table "All Date".
My field "Birthday" in my table All Data is yyy-mm-dd (defined in Data Type - General. Also my input mask is set-up as: 0000-00-00;0;_
When I Right click in the Query Field "Birthday" and thereafter Properties-General-Format, I see already dd-mm-yyy
The result of running the query is that the data is still in the format yyyy-mm-dd. It seems not to display the data in the format as indicated in Format.
Is there anything I do wrong?
Do you need any additional info from me?
Kind regards
Peter
And : Thanks in Advance for helping me.
NeoPa 32,557
Recognized Expert Moderator MVP
Peter, understand this :
Your date data is stored as a Date. Not as a formatted date. If you can get past this concept (unfortunately so many people haven't) then the whole process becomes much easier to work with.
It is important therefore, to make sure your date data is actually stored in a DateTime type field for starters (Some people fail to do this and none of the rest of it works as you cannot format a string value for instance).
Once this is ensured you simply need to understand the difference between formatting a result using the format property, and returning a formatted string as a value. Using the Format property to format the results of a query field is fine for display purposes (and only for display purposes). In such a situation the underlying data remains the same (actually a double-precision floating value - but you probably won't have to worry about those details in most of what you do). If you need to work on the formatted data though then you will need to use the Format() function instead.
The format strings for your two formats are : - "dd-mm-yyyy"
- "yyyy-mm-dd"
Lastly, DateDiff() can be used to determine the number of days between two date/times. This can prove important for correctly reflecting ages.
Peter,
Although Neo has explained very well about dates concept. There is nothing more to add, however, I just want you to check your system date in control panel.
Just follow path : Control Panel- Region and Language or (Clock, language and Region in Windows 7)- Change Date time or number format- Additional settings- Date (tab) and then under Date Format check Short Date format. By default it should be mm/dd/yyyy format. Set it as dd/mm/yyyy (if you want it this way). and then you can check it in your database.
Remember, a computer understand dates as in numbers and it starts with 1. So for a computer 1 means 1/1/1900. So when you use DateDiff() function, it always gives results in number of days (which you can convert to years by dividing with 365.2425)
HTH
NeoPa 32,557
Recognized Expert Moderator MVP
I would urge caution when considering changing any of the System date formats. I would go as far as to say don't do it unless you know it to be wrong for your region.
Formats within an Access database should be managed exclusively within that Access database. It is not responsible development to make changes to a system when the changes pertain simply to a single database.
Certainly ensure the System date formats are correctly set for your system and region, but do not set them up to reflect the requirements of a single database as you will simply be causing yourself a bunch of problems.
PS. DateDiff() certainly can determine the difference in days if requested, but can also do it for other periods as well. The parameter value for using days is "d" if that helps.
Hi Narender Sagar and NeoPa
Thanks for helping me.
My Birthday record was set-up in the Text format. This because I needed yyyy-mm-dd for Export to Gmail. I could only get this format in my query if I did set it up like this.
At that time I did not know that I could select in a query yyyy-mm-dd or dd-mm-yyyy.
I now have changed in the table the properties of my Birthday record to Date/Time and it works perfectly. In my query I can, under format, indicate yyyy-mm-dd for export to GMAIL and in an other Column dd-mm-yyyy for my birthday calender and calculation of the current age.
Thank you both for yr help.
Kind regards,
Peter
Good to know that.. :)
regards,
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Gav |
last post by:
I have a database with date of births stored dd/mm/yyyy (english dating
system) and =date() returns a date in the same format in my server.
how do i find the persons age using these two pieces of...
|
by: A_Rodrigues |
last post by:
Hi
Given a form with a date formated text box on it, which will serve as an
input box for dates, how can I write a VBA sentence in order to apply a
filter with that input?
Suppose text box is...
|
by: BUJAUD Thomas |
last post by:
Hello,
my problem is that i use a c# application which create an excel workbook and
i want to rotate data contained in a specific cell.
Thanks for your help,
Thomas BUJAUD
PS: sorry for...
|
by: Antoon Pardon |
last post by:
Now slices are objects in python, I was wondering if slice
notation will be usable outside subscribtion in the future.
Will it ever be possible to write things like:
a = 4:9
for key, value in...
|
by: geronimi |
last post by:
Vb stores an image (bitmap/jpg) in a SQL2000 image field. For some
reason it doubles the size by adding 00 for each byte. But sometimes it
doesn't add 00 (0000.0000) but 01 or 20 or ?? and also the...
| |
by: geronimi |
last post by:
Vb stores an image (bitmap/jpg) in a SQL2000 image field. For some
reason it doubles the size by adding 00 for each byte. But sometimes it
doesn't add 00 (0000.0000) but 01 or 20 or ?? and also the...
|
by: Arpan |
last post by:
The .NET Framework 2.0 documentation states that
An Object variable always holds a pointer to the data, never the data
itself.
Now w.r.t. the following ASP.NET code snippet, can someone please...
|
by: lovecreatesbeauty |
last post by:
I write a function to rotate a matrix by 90 degrees clockwise, this
function works on a matrix of specific size, for example, it rotates a
4*4 matrix of integers in the following code. The function...
|
by: Greg |
last post by:
I am working on an application that requires working with numbers in
scientific notation. I am using SqlServer as the database and I have
created strongly typed data adapters and datasets. The...
|
by: Joey_Stacks |
last post by:
Does anyone know of a scipt that will rotate random div layers on page
refresh? I have a primary content area front and center on my site
homepage, and I'd like to rotate various chunks of html...
|
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,...
| |
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: 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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |