Solved

Date in gg/mm/dddd format

Posted on 2002-07-29
2
673 Views
Last Modified: 2008-03-10
Kind all, I need to convert a date say - date - in the following format gg/mm/dddd .
Tnx n regards

0
Comment
Question by:getronick
2 Comments
 
LVL 32

Accepted Solution

by:
bhess1 earned 100 total points
ID: 7186568
Can you give a sample output?

You will want to use the Format$() command.  For example:

If what you need is 29/07/2002

Debug.Print Format(Date, "dd/mm/yyyy")

If gg = year (I'm really not sure what gg is), and dddd is day of week (from the format command), then:

Debug.Print Format(Date, "yy/mm/dddd")

From the VB Help:

The following table identifies characters you can use to create user-defined date/time formats:

Character Description
(:) -- Time separator. In some locales, other characters may be used to represent the time separator. The time separator separates hours, minutes, and seconds when time values are formatted. The actual character used as the time separator in formatted output is determined by your system settings.

(/) -- Date separator. In some locales, other characters may be used to represent the date separator. The date separator separates the day, month, and year when date values are formatted. The actual character used as the date separator in formatted output is determined by your system settings.

c -- Display the date as ddddd and display the time as
ttttt, in that order. Display only date information if there is no fractional part to the date serial number; display only time information if there is no integer portion.
d Display the day as a number without a leading zero (1  31).

dd -- Display the day as a number with a leading zero (01  31).

ddd -- Display the day as an abbreviation (Sun  Sat).

dddd -- Display the day as a full name (Sunday  Saturday).

ddddd -- Display the date as a complete date (including day, month, and year), formatted according to your system's short date format setting. The default short date format is m/d/yy.

dddddd -- Display a date serial number as a complete date (including day, month, and year) formatted according to the long date setting recognized by your system. The default long date format is mmmm dd, yyyy.

aaaa -- The same as dddd, only it's the localized version of the string.

w -- Display the day of the week as a number (1 for Sunday through 7 for Saturday).

ww -- Display the week of the year as a number (1  54).

m -- Display the month as a number without a leading zero (1  12). If m immediately follows h or hh, the minute rather than the month is displayed.

mm -- Display the month as a number with a leading zero (01  12). If m immediately follows h or hh, the minute rather than the month is displayed.

mmm -- Display the month as an abbreviation (Jan  Dec).

mmmm -- Display the month as a full month name (January  December).

oooo -- The same as mmmm, only it's the localized version of the string.

q -- Display the quarter of the year as a number (1  4).

y -- Display the day of the year as a number (1  366).

yy -- Display the year as a 2-digit number (00  99).

yyyy -- Display the year as a 4-digit number (100  9999).

h -- Display the hour as a number without leading zeros (0  23).

Hh -- Display the hour as a number with leading zeros (00  23).

N -- Display the minute as a number without leading zeros (0  59).

Nn -- Display the minute as a number with leading zeros (00  59).

S -- Display the second as a number without leading zeros (0  59).

Ss -- Display the second as a number with leading zeros (00  59).

t t t t t -- Display a time as a complete time (including hour, minute, and second), formatted using the time separator defined by the time format recognized by your system. A leading zero is displayed if the leading zero option is selected and the time is before 10:00 A.M. or P.M. The default time format is h:mm:ss.

AM/PM -- Use the 12-hour clock and display an uppercase AM with any hour before noon; display an uppercase PM with any hour between noon and 11:59 P.M.

am/pm -- Use the 12-hour clock and display a lowercase AM with any hour before noon; display a lowercase PM with any hour between noon and 11:59 P.M.

A/P -- Use the 12-hour clock and display an uppercase A with any hour before noon; display an uppercase P with any hour between noon and 11:59 P.M.

a/p -- Use the 12-hour clock and display a lowercase A with any hour before noon; display a lowercase P with any hour between noon and 11:59 P.M.

AMPM -- Use the 12-hour clock and display the AM string literal as defined by your system with any hour before noon; display the PM string literal as defined by your system with any hour between noon and 11:59 P.M. AMPM can be either uppercase or lowercase, but the case of the string displayed matches the string as defined by your system settings. The default format is AM/PM.

0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 7186592
bhess1 solution is best way to go the Format function does everything you want with date
... but please give us a sample of date you want ... what does the 'gg' represent in your question above??
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now