473,547 Members | 2,566 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 11952
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
5176
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
4472
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
54871
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
2132
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
2297
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
16964
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
3157
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
3216
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...
0
7510
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
7437
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
7703
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. ...
0
7797
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
5081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3493
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...
1
1923
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 we have to send another system
1
1050
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
748
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.