Link to home
Start Free TrialLog in
Avatar of matthews_30
matthews_30

asked on

is posible convert mm/dd/yyyy to dd/mm/yyyy in visual basic 6.0?

need to convert a north american date format (mm/dd/yyyy) to a chilean date format (dd/mm/yyyy)

is this posible?

thanks a lot!

matt.
Avatar of jimbobmcgee
jimbobmcgee
Flag of United Kingdom of Great Britain and Northern Ireland image

Try

    a = "11/26/2004"    'DATE IN US FORMAT - 26-NOV-2004
    d = Format(a, "dd/mm/yyyy")     'YOUR DATE FORMAT

or

    a = "11/26/2004"     'DATE IN US FORMAT - 26-NOV-2004
    d = CDate(a)      'DATE IN FORMAT OF SYSTEM

HTH

J.
Avatar of Mikal613
ASKER CERTIFIED SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial



c Displays the date and time.
d Displays the day as a number without a leading zero.
dd Displays the day as a number with a leading zero.
ddd Displays the day as an abbreviation (eg. Mon).
dddd Displays the day as text (eg. Monday).
ddddd Displays the complete date in short format.
dddddd Displays the complete date in long format.
w Displays the day of the week as a number (eg. Sunday = 1).
ww Displays the week of the year as a number.
m Displays the month as a number without a leading zero.
mm Displays the month as a number with a leading zero.
mmm Displays the month as an abbreviation (eg. Jan).
mmmm Displays the month as text (eg. January).
q Displays the quarter of the year (1 - 4).
y Displays the day of the year (1 - 366).
yy Displays the year with two digits.
yyyy Displays the year with four digits.
h Displays the hour without a leading zero.
Hh Displays the hour with a leading zero.
N Displays the minute without a leading zero.
Nn Displays the minute with a leading zero.
S Displays the seconds without a leading zero.
Ss Displays the seconds with a leading zero.
ttttt Displays the complete time according to the locale.
AM/PM
am/pm Displays either a lowercase or uppercase AM or PM adornment for 12-hour formatted time, according to which expression is used.
eg. Format(Now, "Hh:Nn:Ss AM/PM").




some more formats...

Format(Now, “m/d/yy”) 1/27/99
Format(Now, “dddd, mmmm dd, yyyy”) Wednesday, January 27, 1999
Format(Now, “d-mmm”) 27-Jan
Format(Now, “mmmm-yy”) January-99
Format(Now, “hh:mm AM/PM”) 07:18 AM
Format(Now, “h:mm:ss a/p”) 7:18:00 a
Format(Now, “d-mmmm h:mm”) 3-January 7:18




u can use any combination of ur choice...


hi
  jimbobmcgee, u get the point
u were fast
;-)
Thanks, shijusn.  A couple of things to note when using format():

    1.  It will take the date in whichever format it is recognised by the system and display it as per your specification.  Be
         careful, still, when dealing with dates such as 02/10/2004 or 11/10/1995, etc -- it depends on your system settings
         as to what part of the date is recognised as what.

    2.  The results of the available formatting are limited depending on the variable type to which you are storing it.  If you
         are storing the formatted result in a Date variable, you may find it only viewable as dd/mm/yyyy or mm/dd/yyyy.  To
         use formats such as mmm or mmmm, you will have to store as a String but this can limit your date calculations, if
         you do any.

HTH

J.
hi jimbobmcgee
u r right
thanks
;-)
Shiju