Click to See Complete Forum and Search --> : Date fromating inVBscript
Skeen
Sep 20th, 2000, 11:36 AM
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
dcarlson
Sep 20th, 2000, 01:02 PM
Try formatdatetime(date, 3). What sucks is it looks at your computer's regional settings for the format.
monte96
Sep 20th, 2000, 06:50 PM
Yes, you will need to make sure that the server is set up to use MM/dd/yyyy in Control Panel/Regional Settings.
Skeen
Sep 21st, 2000, 02:34 AM
Nice 1 lads, Thanx for the tip.
Skeen.
da_silvy
Sep 21st, 2000, 05:54 PM
they have some examples at http://www.brinkster.com
click "CODE BANK" in the menu thingo
jlanus
Sep 22nd, 2000, 10:02 AM
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.
Skeen
Sep 25th, 2000, 04:45 AM
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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.