If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How do I convert number to a date format in MS Access
I am having a number field in yyyymmdd format. wants to convert into date
field as yyyy/mm/dd in MS Access thanks for the help |
#2
|
|||
|
|||
How do I convert number to a date format in MS Access
Hello there,
One way is to create a Query, add your field in the desing view and create also another field as follows: MyDate: Left([YourFieldName];4) & "/" & Mid([YourFieldName];5;2) & "/" & Right([YourFieldName];2) You can now use the query to update a newly created field in your table. Hope this helps. George Ο χρήστης "chinky" *γγραψε: I am having a number field in yyyymmdd format. wants to convert into date field as yyyy/mm/dd in MS Access thanks for the help |
#3
|
|||
|
|||
How do I convert number to a date format in MS Access
I try not to write expressions that don't explicitly change data from one
type to another and then back again. I also don't like to create complex expressions/calculations that might be useful in several places in an application. Consider using a small function like the following which you can paste into a new module and save it as "basDateConversions". Then, in a query, you can call it like: TrueDate: ConvertYMD([YourYYYYMMDDFieldName]) Function ConvertYMD(varDate As Variant) As Date Dim intYear As Integer Dim intMth As Integer Dim intDay As Integer If IsNull(varDate) Then ConvertYMD = 0 Else intYear = varDate \ 10000 intMth = (varDate Mod 10000) \ 100 intDay = varDate Mod 100 ConvertYMD = DateSerial(intYear, intMth, intDay) End If End Function -- Duane Hookom MS Access MVP "chinky" wrote in message ... I am having a number field in yyyymmdd format. wants to convert into date field as yyyy/mm/dd in MS Access thanks for the help |
#4
|
|||
|
|||
How do I convert number to a date format in MS Access
Thanks George for timely help. Yes I was able to do what I wanted to do.
"chinky" wrote: I am having a number field in yyyymmdd format. wants to convert into date field as yyyy/mm/dd in MS Access thanks for the help |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Update a number field incrementally | AllyOop | Running & Setting Up Queries | 7 | February 22nd, 2006 12:38 PM |
Converting number or text to a Date Format | samhain | New Users | 2 | October 17th, 2005 02:28 PM |
Converting Date Format from YYYY-MM-DD to Access date format | activegirl | General Discussion | 3 | June 21st, 2005 11:03 PM |
Need Subforms? | AccessRookie | Using Forms | 7 | April 8th, 2005 09:30 AM |
incorrect sums in report using 2 tables | jkendrick75 | Setting Up & Running Reports | 22 | December 13th, 2004 02:19 PM |