473,624 Members | 2,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change DATE datatype to NUMBER datatype

How can I change a Date datatype to a Number datatype? For example, I
want a date 10/31/2006 to show 1031 as Number datatype. But I don't
want it becomes 39021. What formula should I use? Thanks for your
help!!

Nov 10 '06 #1
4 11957
On 10 Nov 2006 14:03:21 -0800, Orchid wrote:
How can I change a Date datatype to a Number datatype? For example, I
want a date 10/31/2006 to show 1031 as Number datatype. But I don't
want it becomes 39021. What formula should I use? Thanks for your
help!!
Without knowing more, my gut feeling is you are making a design
mistake.

As a number, how would you display the date of 01/24/2006?

As a Number datatype, Access does not store the leading zero, so a
date of 01/24/2006, as the number 124, would represent what?
1/24 or 12/4?

If for some reason, you don't wish to store the date as Date/Time, try
a Text datatype. As Text, Access stores leading zero's.

=Format([DateField],"mmdd") will return 0124 as text.

Now what do you intend to do with the value?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 10 '06 #2
Thanks for your reply!!
Any formula to change the date of 01/24/2006 as the number 124?
I need to format the data on MS Access then export as a Text file. Now
when I try by format as Text datatype, it works too. Just I want to
know the formula of how to change a Date as Number datatype. Again,
thanks for your help!

fredg wrote:
On 10 Nov 2006 14:03:21 -0800, Orchid wrote:
How can I change a Date datatype to a Number datatype? For example, I
want a date 10/31/2006 to show 1031 as Number datatype. But I don't
want it becomes 39021. What formula should I use? Thanks for your
help!!

Without knowing more, my gut feeling is you are making a design
mistake.

As a number, how would you display the date of 01/24/2006?

As a Number datatype, Access does not store the leading zero, so a
date of 01/24/2006, as the number 124, would represent what?
1/24 or 12/4?

If for some reason, you don't wish to store the date as Date/Time, try
a Text datatype. As Text, Access stores leading zero's.

=Format([DateField],"mmdd") will return 0124 as text.

Now what do you intend to do with the value?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 13 '06 #3
On 13 Nov 2006 07:06:17 -0800, Orchid wrote:
Thanks for your reply!!
Any formula to change the date of 01/24/2006 as the number 124?
I need to format the data on MS Access then export as a Text file. Now
when I try by format as Text datatype, it works too. Just I want to
know the formula of how to change a Date as Number datatype. Again,
thanks for your help!

fredg wrote:
>On 10 Nov 2006 14:03:21 -0800, Orchid wrote:
>>How can I change a Date datatype to a Number datatype? For example, I
want a date 10/31/2006 to show 1031 as Number datatype. But I don't
want it becomes 39021. What formula should I use? Thanks for your
help!!

Without knowing more, my gut feeling is you are making a design
mistake.

As a number, how would you display the date of 01/24/2006?

As a Number datatype, Access does not store the leading zero, so a
date of 01/24/2006, as the number 124, would represent what?
1/24 or 12/4?

If for some reason, you don't wish to store the date as Date/Time, try
a Text datatype. As Text, Access stores leading zero's.

=Format([DateField],"mmdd") will return 0124 as text.

Now what do you intend to do with the value?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
If the Date is today's date (11/13/2006) ...
To change a Date datatype value to a number
CLng(Date())
39034

To change today's date formatted as "mmdd" to a number:
CInt(Format(Dat e(),"mmdd"))
1113
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 13 '06 #4
Thanks so much for your help!

fredg wrote:
On 13 Nov 2006 07:06:17 -0800, Orchid wrote:
Thanks for your reply!!
Any formula to change the date of 01/24/2006 as the number 124?
I need to format the data on MS Access then export as a Text file. Now
when I try by format as Text datatype, it works too. Just I want to
know the formula of how to change a Date as Number datatype. Again,
thanks for your help!

fredg wrote:
On 10 Nov 2006 14:03:21 -0800, Orchid wrote:

How can I change a Date datatype to a Number datatype? For example, I
want a date 10/31/2006 to show 1031 as Number datatype. But I don't
want it becomes 39021. What formula should I use? Thanks for your
help!!

Without knowing more, my gut feeling is you are making a design
mistake.

As a number, how would you display the date of 01/24/2006?

As a Number datatype, Access does not store the leading zero, so a
date of 01/24/2006, as the number 124, would represent what?
1/24 or 12/4?

If for some reason, you don't wish to store the date as Date/Time, try
a Text datatype. As Text, Access stores leading zero's.

=Format([DateField],"mmdd") will return 0124 as text.

Now what do you intend to do with the value?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

If the Date is today's date (11/13/2006) ...
To change a Date datatype value to a number
CLng(Date())
39034

To change today's date formatted as "mmdd" to a number:
CInt(Format(Dat e(),"mmdd"))
1113
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 20 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5179
by: Cristian Martinello | last post by:
There's a way to check if a string is a valid date ? Thanks helpers. -- Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
4
4476
by: Tony | last post by:
Hey guys, I use Google Groups quite a bit as it is an enormous wealth of information, and now I need some help. I have created a query using parameters to capture a range of date, the date is also formatted. test: Format(,"mm/dd/yy") Between And
4
54882
by: Peter Bailey | last post by:
I have a subform that I dont want to have a recordsource initially as it is locking the table that is created dynamically. I want to connect to the table after the data has been written by another routine. I had hoped I could do mytable.recordsource = myquery
5
816
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
7
2138
by: dotnetnoob | last post by:
i keep getting Object references not set to an instance of an object from this code: Private Sub EqBinding() Dim x As Integer x = 0 Do If CStr(arlsType.Item(x)) = "Bacnet Point" Then Dim str1, str2 As String str1 = CStr(arlsFilePath.Item(x))
4
2301
by: peterson | last post by:
We are trying to enter birthdays in a 00/00 date format, and it does not accept 2/29 or 02/29 as a legal date. Any work arounds for this? Thank you, Amy Peterson, MMI
10
16996
by: DontellTrevell via AccessMonster.com | last post by:
HELP!!....I need to calculate the numer of days elapsed between two field. But, the date format is YYYYMMDD. How can i accomplsh this? -- Dontell Trevell Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200701/1
4
3163
by: Simon Gare | last post by:
Hi all, I am trying to retrieve a count of booking entries made 30 days ago, below is the end of the query I am having problems with. dbo.booking_form.TimeOfBooking = DATEADD(day, -30, GetDate()) GROUP BY dbo.booking_form.TimeOfBooking") When I use the = sign the error reads
1
3219
by: cjordan | last post by:
Hi everyone. I'm new here, and I think I've got a pretty unique problem (haven't found any solution to this anywhere else), but I'm hoping that someone here can help me. To be honest, I'm not a DB2 guy. I'm a contractor working for a client who uses a very old AS400 to do their payroll. They're running V5R3. I'm not sure if that refers to the version of DB2 or the version of the iSeries OS that we're running. Maybe they're the same thing. As...
0
8681
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8629
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6112
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4084
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.