By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,890 Members | 1,226 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,890 IT Pros & Developers. It's quick & easy.

Convert date to number and back

P: n/a
I have a need to convert simple dates (i.e. 02/14/2005) to a number,
do some math, and convert back to a date. (in a simple query).
The math involves adding or substracting days, and days of the week .
I've used the weekday() function to convert dates to numberic days of
the week (1-7)

I've used cdbl (date) to convert a date to a serial number, but then I
do math with the number and I can't seem to convert this back to a
date.

Help is appreciated

Thanks
Jerry Ranch

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jerry,
You are making this harder than it needs to be. DateAdd & DateDiff are two
functions for adding & subtracting dates that Microsoft includes with VBA.
Try those.

--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS"

<je*********@pioneer.com> wrote in message
news:ia********************************@4ax.com...
I have a need to convert simple dates (i.e. 02/14/2005) to a number,
do some math, and convert back to a date. (in a simple query).
The math involves adding or substracting days, and days of the week .
I've used the weekday() function to convert dates to numberic days of
the week (1-7)

I've used cdbl (date) to convert a date to a serial number, but then I
do math with the number and I can't seem to convert this back to a
date.

Help is appreciated

Thanks
Jerry Ranch

Nov 13 '05 #2

P: n/a
Jerry,

Look at the DateAdd and DateSerial functions in the Help file. They will
probably do all you want to do without any conversion.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
<je*********@pioneer.com> wrote in message
news:ia********************************@4ax.com...
I have a need to convert simple dates (i.e. 02/14/2005) to a number,
do some math, and convert back to a date. (in a simple query).
The math involves adding or substracting days, and days of the week .
I've used the weekday() function to convert dates to numberic days of
the week (1-7)

I've used cdbl (date) to convert a date to a serial number, but then I
do math with the number and I can't seem to convert this back to a
date.

Help is appreciated

Thanks
Jerry Ranch

Nov 13 '05 #3

P: n/a
Thanks people
I got the tools I need now
Jerry

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.