[RESOLVED] How to format '2/13/2012' date to 'February 13, 2012'
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] How to format '2/13/2012' date to 'February 13, 2012'

  1. #1
    Join Date
    Aug 2012
    Posts
    2

    [RESOLVED] How to format '2/13/2012' date to 'February 13, 2012'

    Hi,

    Let's say I have the following statement in VB6:

    Code:
    '-subject and className are strings, and classDate is a date
    
    subject = "Student Registered: " & className & " on " & classDate
    So, once the line executes, the content of subject would be

    "Student Registered: How To Not Be Bad at TF2 on 2/13/2012"

    However, I would like subject to either be:

    "Student Registered: How To Not Be Bad at TF2 on Feb 13, 2012" or "Student Registered: How To Not Be Bad at TF2 on February 13, 2012"

    How can I accomplish this? Trying to google this topic keeps sending me to VB.NET forum posts, but I need to know how to format a date in VB6.

    Thanks!

  2. #2
    Join Date
    Jul 2005
    Posts
    1,074

    Re: How to format '2/13/2012' date to 'February 13, 2012'

    Try:
    Code:
    subject = "Student Registered: " & className & " on " & Format(classDate,"mmm dd, yyyy")
    'or
    subject = "Student Registered: " & className & " on " & Format(classDate,"mmmm dd, yyyy")
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  3. #3
    Join Date
    Aug 2012
    Posts
    2

    Re: [RESOLVED] How to format '2/13/2012' date to 'February 13, 2012'

    Thanks, jggtz!

    If anyone's curious, I also found what I *think* is a page on VB6 formatting characters: http://dltechdev.com/vb/VBFormat.htm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center