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

Advertisements

Check no record in ADO

Use the code below:


If rs.BOF And rs.EOF Then  ' Todo - No record found

I always forget this simple code to check empty record in ADO, now write it here to remind myself.

Search Keyword: ADO,check empty record, return empty record, No record found