PC Review


Reply
Thread Tools Rate Thread

Change format DATE language

 
 
Animal via OfficeKB.com
Guest
Posts: n/a
 
      25th Oct 2007
Hi,

I have two problems:

1. I'm doing a general template. All the workstations are having the default
language for the format DATE set to Swedish, but I have to have it in English.
I have created a custom list containing "jan, feb, mar, apr, may, jun, jul,
aug, sep, oct, nov, dec" on my computer but this does not apply when I change
computer. When I for example switch computer and do an autofill it comes out
in Swedish.
How can I secure that I get the DATE format series in english?

2. The second problem continues in this problem, but can maybe be solved if
the first problem is, or? I have to do some calulations with a DATE variable,
to basically add a month to a variable.

Here is my code:

Dim reportdateOk As Date

reportdateOk = Range("ReportYear") & "-" & Range("ReportMonth") ex: (2007-
05-01)
reportdateOk2 = DateAdd("m", 1, reportdateOk)
ex: (2007-06-01)

This workes perfectly if I use Swedish months or months that are the same in
the swedish language (all months except for "maj" and "okt"), but not when I
use English months, because the variable reportDateOK is a DATE-variable and
it is programmed for Swedish.

Can someone please help me?

Thanks in advance!
/Animal

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200710/1

 
Reply With Quote
 
 
 
 
Ronald Dodge
Guest
Posts: n/a
 
      25th Oct 2007
First and foremost, be sure to be using the "Date" data type to assign to
date variables, so as all dates (whole number) and times (decimal number)
will be serialized.

From there, you can then use the "VBA.Format" function to return the format
of the date that you need. If you use the named date format, it will go by
what ever date format is setup on that system such as the following line of
command.

strDateOK = VBA.Format(reportdateOK,"Medium Date")

To see the different date/time format settings on a particular system, goto
Control Panel, Regional Settings.

Generally speaking, when I create variables, I explicitly assign them to
what ever type variable I plan on using it as, and I also set the first 3
letters of the variable name accordingly, such as the following

Dim dteReportDateOK as Date

This naming then allows for people to know what type of variable it is, and
more or less what it's for.

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000

"Animal via OfficeKB.com" <u33413@uwe> wrote in message
news:7a38904dbc9ef@uwe...
> Hi,
>
> I have two problems:
>
> 1. I'm doing a general template. All the workstations are having the
> default
> language for the format DATE set to Swedish, but I have to have it in
> English.
> I have created a custom list containing "jan, feb, mar, apr, may, jun,
> jul,
> aug, sep, oct, nov, dec" on my computer but this does not apply when I
> change
> computer. When I for example switch computer and do an autofill it comes
> out
> in Swedish.
> How can I secure that I get the DATE format series in english?
>
> 2. The second problem continues in this problem, but can maybe be solved
> if
> the first problem is, or? I have to do some calulations with a DATE
> variable,
> to basically add a month to a variable.
>
> Here is my code:
>
> Dim reportdateOk As Date
>
> reportdateOk = Range("ReportYear") & "-" & Range("ReportMonth") ex:
> (2007-
> 05-01)
> reportdateOk2 = DateAdd("m", 1, reportdateOk)
> ex: (2007-06-01)
>
> This workes perfectly if I use Swedish months or months that are the same
> in
> the swedish language (all months except for "maj" and "okt"), but not when
> I
> use English months, because the variable reportDateOK is a DATE-variable
> and
> it is programmed for Swedish.
>
> Can someone please help me?
>
> Thanks in advance!
> /Animal
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.a...mming/200710/1
>



 
Reply With Quote
 
Animal via OfficeKB.com
Guest
Posts: n/a
 
      26th Oct 2007
Hi again,

I think I understand what you mean but I can't get it to work, maybe I
explained it to you weared, let me try again:

1. The default system settings on all computers are set to Swedish language.
2. Cells on my worksheet:

StartDate 2006-10-03 This is DATE-format, in Swedish
language YYYY-MM-DD
EndDate 2007-11-30 This is DATE-format, in Swedish
language YYYY-MM-DD

ReportMonth May This is choosen from a list, and the
format is General.
ReportYear 2007 This is choosen from a list, and
the format is General.

3. My code:

Dim dteReportDateOk As Date

dteReportDateOk = Range("ReportYear") & "-" & Range("ReportMonth") (
output = 2007-05-01)
ReportDateOk2 = DateAdd("m", 1, dteReportDateOk)
( output = 2007-06-01)

If reportdateOk2 >= Range("StartDate") then..........

This code givs me an error because the ReportMonth (May) is in english, but
when it is in Swedish it workes just fine.
So I believe that I have to change the system settings before I do this code
and change it back again, but how do I do that?

Thanks in advance,
/Anita

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200710/1

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change date format dd/mm/yyyy to Julian date format? itzy bitzy Microsoft Excel Worksheet Functions 1 8th Dec 2009 07:42 PM
change format language =?Utf-8?B?amF5?= Microsoft Access 1 18th Mar 2007 07:45 PM
How to change the excel format from language to language? =?Utf-8?B?emVl?= Microsoft Excel Misc 2 30th Jan 2005 06:51 PM
Change german date-format in englisch date-format? pedros25 Microsoft Excel Programming 2 16th Mar 2004 10:28 AM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Microsoft Excel Programming 1 24th Nov 2003 11:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:36 PM.