VBScript - General - Question - DateFormat

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • danasegarane
    New Member
    • Mar 2007
    • 32

    VBScript - General - Question - DateFormat

    Hi all
    I am having a Date as
    01-09-2008".(mm-dd-yyyy")
    Now I am passing this date to WeekDay Function. This Function is not formating that to Regional settings . This format it as "dd-mm-yyyy". How to format the Date to the WeekDay Function with respect to regional settings of the client
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    You can use Format functon from vbscript in order to change the date format of given date.
    e.g.

    Code:
    <%
    Dim date1
    
    ''''Use Format function for converting date to dd-mm-yyyy format
    date1= Format("01-09-2008","dd-mm-yyyy")
    Response.write(date1)
    
    %>
    Originally posted by danasegarane
    Hi all
    I am having a Date as
    01-09-2008".(mm-dd-yyyy")
    Now I am passing this date to WeekDay Function. This Function is not formating that to Regional settings . This format it as "dd-mm-yyyy". How to format the Date to the WeekDay Function with respect to regional settings of the client

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      Although this "should" work, sometimes making it work is difficult. The best solution I have found (which always works) is to always store and display the date in a non-ambiguous format such as "2008-Sep-12". Even though it isn't the standard, this format is never confused.

      Jared

      Comment

      Working...