Forums

This topic is locked

I wish

Posted 22 Oct 2001 12:51:08
1
has voted
22 Oct 2001 12:51:08 Guenther Kraibacher posted:
I wish a date formatting behaviour for US, English and German date format.

Replies

Replied 22 Oct 2001 17:17:33
22 Oct 2001 17:17:33 Owen Eastwick replied:
Here's how to Format your date to anything you like using VBScript:
<pre id=code><font face=courier size=2 id=code>
&lt;%
varLocale = SetLocale(2057)
varDate = Now()
varDate = FormatDateTime(varDate, 0)
%&gt;
</font id=code></pre id=code>
SetLocale - this will set the Date Time format according to country specific formats. eg.

1033 is English-US gives a Date Time like: 10/22/2001 3:59:37 PM
2057 is English-UK gives a date time like: 22/10/2001 15:59:37
1031 is German-Standare gives a date time like: 22.10.2001 15:59:37

FormatDateTime this will format a Date Time variable as follows:

<pre id=code><font face=courier size=2 id=code>
Constant Value Description
vbGeneralDate 0 Display a date and/or time. If there is a date part, display it as a short date. If there is a time part, display it as a long time. If present, both parts are displayed.
vbLongDate 1 Display a date using the long date format specified in your computer's regional settings.
vbShortDate 2 Display a date using the short date format specified in your computer's regional settings.
vbLongTime 3 Display a time using the time format specified in your computer's regional settings.
vbShortTime 4 Display a time using the 24-hour format (hh:mm).
</font id=code></pre id=code>

Go to Microsoft and download Windows Script 5.6 Documentation which is an installable help file containing a complete refernce for VBScript, Jscript an more.

Go to: msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/001/728/msdncompositedoc.xml

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Reply to this topic