Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Queries

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 09-09-2008, 11:56 AM
Novice
 
Join Date: Jul 2008
Posts: 4
~SwAmPdOnKeY~ is on a distinguished road
Default Convert string to date

Hi everyone,

I am in need of help converting a string yymmdd (ex: 080907 = Sept 7, 2008) to a date format as dd/mm/yyyy. I need to do this in a query or visual basic code?
Reply With Quote
  #2  
Old 09-10-2008, 11:53 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

Have you tried using the Mid() function?
Reply With Quote
  #3  
Old 09-10-2008, 05:35 PM
Novice
 
Join Date: Jul 2008
Posts: 4
~SwAmPdOnKeY~ is on a distinguished road
Default

Yes, I ended up using
CDate(mid([date],24),left([date],2),right([date],2)) to format it to mm/dd/yy
then short date format on filed property to make it mm/dd/yyyy
Reply With Quote
  #4  
Old 09-11-2008, 06:37 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

Glad you got it sorted. BTW, using date as a field name can be problematic since it is a reserved word. http://www.allenbrowne.com/AppIssueBadWord.html
Reply With Quote
  #5  
Old 09-11-2008, 05:19 PM
Novice
 
Join Date: Jul 2008
Posts: 4
~SwAmPdOnKeY~ is on a distinguished road
Default

Lol, I have learned that the hard way. It is actually named nDate.

Thanks!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract numbers from text string strored in a field. khabdullah Programming 2 12-23-2007 03:55 PM
Creating a string from all records in a table ocordero Programming 2 08-07-2006 07:21 AM
Make sure end date is one year greater than start date AimeeK Forms 1 12-09-2005 07:29 PM
How can I get a Expression in a String to A Query? Willot Programming 0 12-05-2005 01:09 AM


All times are GMT -8. The time now is 02:49 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.