Date format from one culture to another

Discussion in 'ASP General' started by dotnettester, Sep 8, 2005.

  1. dotnettester

    dotnettester Guest

    Hi,

    I know how you can format date by describing culture info on ASP.net . How
    can I do the same thing in classic ASP.

    ?
    Tnx
    dotnettester, Sep 8, 2005
    #1
    1. Advertising

  2. dotnettester wrote:
    > Hi,
    >
    > I know how you can format date by describing culture info on ASP.net
    > . How can I do the same thing in classic ASP.
    >
    > ?
    > Tnx

    http://www.aspfaq.com/show.asp?id=2260
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 8, 2005
    #2
    1. Advertising

  3. dotnettester

    Bullschmidt Guest

    To make a variable be in the format of mm/dd/yyyy (and the final line of
    code can be modifed for other date formats), perhaps try something like
    the following which you might even make into a function that you could
    put on a page that gets included in your main pages:

    varFld = CDate(MyVariable)

    intMonth = Month(varFld)
    intDay = Day(varFld)
    intYr = Year(varFld)

    If intMonth < 10 Then
    strMonth = "0" & CStr(intMonth)
    Else
    strMonth = CStr(intMonth)
    End If

    If intDay < 10 Then
    strDay = "0" & CStr(intDay)
    Else
    strDay = CStr(intDay)
    End If

    strYr = Right(CStr(intYr), 4) ' And change the 4 to 2 for 2 year dates.

    varFld = CStr(strMonth & "/" & strDay & "/" & strYr)

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    http://www.Bullschmidt.com
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...

    <<
    I know how you can format date by describing culture info on ASP.net .
    How can I do the same thing in classic ASP.
    >>


    *** Sent via Developersdex http://www.developersdex.com ***
    Bullschmidt, Sep 9, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vidar Petursson

    Re: Javascript: date in culture/language format.

    Vidar Petursson, Aug 15, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    5,500
    Vidar Petursson
    Aug 15, 2003
  2. Brian Candy
    Replies:
    2
    Views:
    1,159
    Janaka
    Feb 18, 2004
  3. Kiran
    Replies:
    2
    Views:
    371
    Kiran
    Aug 10, 2005
  4. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,251
    Michael Borgwardt
    May 30, 2004
  5. Rod Billett

    Datagrid Column Date Format : Recognizes Browser Culture

    Rod Billett, Aug 27, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    181
    Rod Billett
    Aug 27, 2003
Loading...

Share This Page