473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I Reverse the Format of a Date

5 New Member
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
Aug 5 '11 #1
7 7920
Narender Sagar
189 New Member
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.
Aug 5 '11 #2
Peter Dam
5 New Member
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.
Aug 5 '11 #3
NeoPa
32,564 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 :
  1. "dd-mm-yyyy"
  2. "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.
Aug 5 '11 #4
Narender Sagar
189 New Member
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
Aug 5 '11 #5
NeoPa
32,564 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.
Aug 5 '11 #6
Peter Dam
5 New Member
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
Aug 8 '11 #7
Narender Sagar
189 New Member
Good to know that.. :)
regards,
Aug 8 '11 #8

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

Similar topics

20
11815
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 date. thanks gavin
3
9482
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 "TEXT13" and the table field is "Data of birth". When I run a code like this DoCmd.ApplyFilter , " = " & "#" & Me. & "#"
1
1855
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 my bad english
23
2310
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 tree.items('alfa.': 'beta.'): -- Antoon Pardon
2
1417
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 byte that should be transferd is changed... So SQLImageData = Imagebyte + 00 and sometimes SQLImageData = CHANGEDImagebyte + xx. Some example...
2
1075
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 byte that should be transferd is changed... So SQLImageData = Imagebyte + 00 and sometimes SQLImageData = CHANGEDImagebyte + xx. Some example...
7
2848
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 explain me what does the above statement mean? <script runat="server"> Class Clock
8
11011
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 makes one more copy of the original matrix, how is the efficiency? Can the copy be saved? Comments on it are welcome. Can I extend it to work on...
2
7007
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 numbers are defined as numeric in the SqlServer Database and are bound to text boxes in the app. In the dataset's xml these numbers are defined as...
10
10916
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 (in div layers) each time a user reloads the page. Right now I'm resorting to a random image rotation (those scripts are a dime a dozen) on refresh,...
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3651
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.