PC Review


Reply
Thread Tools Rate Thread

date fields that are not date types

 
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      18th Aug 2005
hey all,

i have a number field i need to convert
from
20050818
to
08182005

can someone please show me some ways i can do this?

thanks,
rodchar


 
Reply With Quote
 
 
 
 
Dragon
Guest
Posts: n/a
 
      18th Aug 2005
Hi,

Date.ParseExact("20050818", "yyyyMMdd", Nothing).ToString("MMddyyyy")

HTH

Roman

"rodchar" <(E-Mail Removed)> сообщил/сообщила в
новостях следующее:
news:C5B58584-D892-4D88-A3FB-(E-Mail Removed)...
> hey all,
>
> i have a number field i need to convert
> from
> 20050818
> to
> 08182005
>
> can someone please show me some ways i can do this?
>
> thanks,
> rodchar
>
>



 
Reply With Quote
 
Phill. W
Guest
Posts: n/a
 
      18th Aug 2005
"rodchar" <(E-Mail Removed)> wrote in message
news:C5B58584-D892-4D88-A3FB-(E-Mail Removed)...
> i have a number field i need to convert
> from
> 20050818
> to
> 08182005


Without resorting to nasty Modular mathematics :

i = 20050818

s = i.ToString()
s = s.SubString( 4, 4 ) & s.SubString( 0, 4 )

i = CInt( s ) ' or Convert.ToInt32( s ), whichever you prefer.

Neither of which, of course, are dates - to get those, you'd need :

s = i.ToString()
s = s.SubString( 0, 4 ) _
& "-" & s.SubString( 4, 2 ) _
& "-" & s.SubString( 6, 2 )
d = CDate( s )

HTH,
Phill W.


 
Reply With Quote
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      18th Aug 2005
thanks, this helped.

"rodchar" wrote:

> hey all,
>
> i have a number field i need to convert
> from
> 20050818
> to
> 08182005
>
> can someone please show me some ways i can do this?
>
> thanks,
> rodchar
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
i have two date fileds Opend date Due date, can i set default on due date so, its always = to open date on my data entry form1 Urgent Mike Saifie Microsoft Access Form Coding 1 9th Mar 2006 01:08 AM
date fields - link the calander pop-up to a custom date field =?Utf-8?B?VG9t?= Microsoft Outlook Form Programming 0 23rd Jan 2006 09:13 PM
Bold face entry date fields that are past the current date. =?Utf-8?B?ZGNsYXJjcQ==?= Microsoft Access Database Table Design 4 13th Sep 2005 07:26 AM
Date fields automatically changing when today date matches date field entry.Help! Brian Cassin Microsoft Access Forms 1 15th Nov 2003 01:51 PM
Date fields automatically updating when field matches todays date!?! Help! Brian Cassin Microsoft Access Forms 1 14th Nov 2003 08:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:19 AM.