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

yy date format gives a result with 4 digits

10
i have a query that subtracts the date of birth (dob) from the date, i.e.
age_d: Date()-[dob]
This is OK as it gives me the difference in days e.g. 700 days. i would like the result to show me the age as Years/Months. If i use yy/mm as the format, the result gives a full year format and month e.g 1903/04. for sure this is not what i want, i would like a format e.g. 03/04.

Anyone please assist.
Apr 17 '07 #1
2 1404
MMcCarthy
14,534 Expert Mod 8TB
Try this ...

age_d: CStr(DateDiff("m", [dob], Date())/12) & " " & CStr(DateDiff("m", [dob], Date())%12)
Apr 20 '07 #2
gngui
10
hi,
Thanks but i found another much longer solution i.e. i have a column that returns a value depending on the date of birth and the current birth;

dt_variance: (DatePart("d",Date())<DatePart("d",[Dob]))

After i use this value to get the number of months;

Months: Int(DateDiff("m",[dob],Date()))+[dt_variance]

Then i het the number of years and months & combine both values;

AgeYears: Int([Months]/12)
AgeMonths: [Months] Mod 12

Thanks for your post though i never tried the solution. My solution works though very long process.
Oct 2 '07 #3

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

Similar topics

3
by: Adrian Parker | last post by:
I have a server app which is sent a date in the local format of the client machine. I've no control over the client app at all, so have to code at the server end to cope with any problems. The...
2
by: Abby Lee | last post by:
http://www.apriori-it.co.uk/FormatDate.asp I found the above date format script while doing a search. it works fine except with the format mm/dd/yyyy. Type in 01/02/03 and hit the "format date"...
1
by: Mike MacSween | last post by:
This looks like a bug to me. I have an expression on a report: =Format(Sum((**)*(/)),"0.00") Score is byte PercentOfGrade is double PropDegree is single ModuleCats is byte
12
by: DC Gringo | last post by:
How can I convert this pubLatest to a date with format "m/d/yyyy"? Dim pubLatest As New Date pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Value -- _____ DC G
15
by: Dave Rado | last post by:
1) I want to be able to display the date in dd format. If in my script file I have: var dd = DayOfMonthArray; and in my html page I have: <script type="text/javascript">...
11
by: shsandeep | last post by:
I used the following query to retrieve the date in dd-mon-yyyy format. db2 => SELECT RTRIM(CHAR(DAY(COVG_TYP_STRT_DT))) || '-' || RTRIM(MONTHNAME(COVG_TYP_STRT_DT)) || '-' ||...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I format Last Modified date with javascript...
17
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
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
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: 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
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
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
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
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...
0
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...

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.