Results 1 to 7 of 7

Thread: Date fromating inVBscript

  1. #1

    Thread Starter
    Addicted Member Skeen's Avatar
    Join Date
    Jul 2000
    Location
    Abingdon, Oxon
    Posts
    138

    Smile

    Hello everybody

    Can anybody tell me how to format the date function in VBscript? Currently it is in 'dd/mm/yy' format but I need to use dd/mm/yyyy. The format function in VB is not supported in VBscript, can anyone help?

    ie

    Daily = Date 'Works fine

    Daily = format(Date, "dd/mm/yyyy") 'Dosn't work

    Cheers 'n' beers

    Skeen
    "It wasn't the booze that made me snooze, It was the Gin that did me in!"

  2. #2
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Sudbury, Ontario, Canada
    Posts
    274
    Try formatdatetime(date, 3). What sucks is it looks at your computer's regional settings for the format.

  3. #3
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Yes, you will need to make sure that the server is set up to use MM/dd/yyyy in Control Panel/Regional Settings.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  4. #4

    Thread Starter
    Addicted Member Skeen's Avatar
    Join Date
    Jul 2000
    Location
    Abingdon, Oxon
    Posts
    138

    Thumbs up Cheers Guys

    Nice 1 lads, Thanx for the tip.

    Skeen.
    "It wasn't the booze that made me snooze, It was the Gin that did me in!"

  5. #5
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    they have some examples at http://www.brinkster.com

    click "CODE BANK" in the menu thingo

  6. #6
    New Member
    Join Date
    Sep 2000
    Location
    Argentina
    Posts
    2

    Re: Cheers Guys

    Originally posted by Skeen
    Nice 1 lads, Thanx for the tip.

    Skeen.
    Hi, Skeen
    I had the same problem some years ago. I was programming in Argentina (dmy format) but the scripts were run in a srever located USA (MDY format) and in a test server in Argentina (DMY format).
    Also, client computers were random set up.
    So I wrote a function (sorry I don't have it any more) that extracted the D, M and Y parts of the date in three integers and then formatted the integers in the order I wanted.
    It worked with both kind of setups.
    Juan Lanus
    TECNOSOL

  7. #7

    Thread Starter
    Addicted Member Skeen's Avatar
    Join Date
    Jul 2000
    Location
    Abingdon, Oxon
    Posts
    138
    I've been messing around with this date thing,
    To illiminate client regional settings date must be formatted in code, and I've sussed that its case sensitive

    ie:

    ToDate('" & StartDateTime & "', 'dd/MM/yyyy HH24:MI:SS')

    Will fromate a date day/month/year and 24Hr Time

    ie "25/09/2000 18:46:33"

    Cheers for all the tips everyone!
    Nice1

    Skeen.
    "It wasn't the booze that made me snooze, It was the Gin that did me in!"

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