PC Review


Reply
Thread Tools Rate Thread

Convert date like string to serial number

 
 
Chrisso
Guest
Posts: n/a
 
      16th Jan 2007
Hi All

Here is a simple question:

How can I turn a date-like string (e.g. "01/01/07") to its date
serial number equivalent (39083) using VB?

I can do this easily in Excel itself (using the VALULE formulae or
changing the cell type) but am struggling to do this in VB.

Thanks in advance for any ideas.

Chris

 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      16th Jan 2007
one way:

Dim nSerial As Long
nSerial = CLng(DateValue("01/01/07"))

In article <(E-Mail Removed)>,
"Chrisso" <(E-Mail Removed)> wrote:

> Hi All
>
> Here is a simple question:
>
> How can I turn a date-like string (e.g. "01/01/07") to its date
> serial number equivalent (39083) using VB?
>
> I can do this easily in Excel itself (using the VALULE formulae or
> changing the cell type) but am struggling to do this in VB.
>
> Thanks in advance for any ideas.
>
> Chris

 
Reply With Quote
 
Chrisso
Guest
Posts: n/a
 
      19th Jan 2007
Thanks JE - just what I needed.

Strange that there is not a built in function to do this although its
implementation would probably be the one you provided. It would make
the code more readable.

Chris

JE McGimpsey wrote:
> one way:
>
> Dim nSerial As Long
> nSerial = CLng(DateValue("01/01/07"))
>
> In article <(E-Mail Removed)>,
> "Chrisso" <(E-Mail Removed)> wrote:
>
> > Hi All
> >
> > Here is a simple question:
> >
> > How can I turn a date-like string (e.g. "01/01/07") to its date
> > serial number equivalent (39083) using VB?
> >
> > I can do this easily in Excel itself (using the VALULE formulae or
> > changing the cell type) but am struggling to do this in VB.
> >
> > Thanks in advance for any ideas.
> >
> > Chris


 
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
Convert date to serial number callbr549 Microsoft Excel Programming 12 30th Mar 2009 10:35 PM
convert serial number into date santhu Microsoft Excel Misc 2 28th Oct 2006 10:27 AM
convert date serial number, to mm/dd/yy? wojo Microsoft Access 1 18th Jul 2005 04:48 AM
Convert date to serial number Ha Microsoft Access Reports 5 10th Feb 2004 04:47 AM
Convert date to serial number in VBA Michael J. Malinsky Microsoft Excel Programming 1 10th Sep 2003 08:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:44 AM.