Display forward slash (‘/’) in date under VB6

When want to show forward slash (‘/’) in date, I use the code below:


Format(Now,"dd/MM/yyyy")

However above code will return 31-01-2008, this is because forward slash “/” will replace by default separator in local PC if default date seperator is “-“.

To check your default date seperator, go to : Control Panel->Regional Settings->Customize->Date-> “Date seperator” in Short date format

date-seperator

You would not see the problem if your local PC date seperator is “/”.

In order to ensure system print the forward slash in date,use the code below:


Format(Now,"dd\/MM\/yyyy")

The code will give 31/01/2008 no matter what is the date seperator.

Reference: http://support.microsoft.com/kb/102045

Search Keyword: Date, slash, seperator

One response to “Display forward slash (‘/’) in date under VB6

  1. Pingback: Display forward slash (’/’) in date using C# « 大脚板日记

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s