Results 1 to 2 of 2

Thread: Format Function, Isn't Formatting.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Location
    USA
    Posts
    25

    Format Function, Isn't Formatting.

    I have:
    VB Code:
    1. strFileName = MyPath & Chr(92) & "activity_" & Format(System.DateTime.Now, "MM-DD-YYYY") & ".csv"

    And for some reason the format part is returning:
    07-DD-YYYY

    And not, 07-25-2003.

    I can't seem to figure out what is wrong. Any ideas?

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim tm As Date = Date.Now.ToLongDateString
    3.         MessageBox.Show(tm) '/// this returns 25/07/2003 on my system
    4.         '////////////////////////////////////////////////////////////
    5.         '/// now you need to use FormatDateTime if you want to do the vb6 way.
    6.         MessageBox.Show(FormatDateTime(Now, DateFormat.LongDate)) '/// this returns 25/July/2003.
    7.     End Sub

    obviously in some regions the date shows as 07/25/2003 , but in the UK where i am it's 25/07/2003 .
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

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



Click Here to Expand Forum to Full Width