Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Pls Answer Me, How Can I SET To Long Date Fomat The Date Settings In Regional Setting


Pls answer me, how can i SET to long date fomat the date settings in regional settings? i want that when my form loads, it automatically change the date settings in the regional settings to long date format




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Convert Short Date Settings To Long Date Setting (control Panel - Regional Settings)
does anybody know how to automatically convert the shortdate format of the date settings in the control panel-regional settings to long date format?

How To Set The Date Into Long Date Format In The Regional Settings?
how can i SET the date into long date format (regional settings)?

i want that once my form is loaded, it will automatically SET the date in the regional settings into long date format.

Setting Long - Short Date Format In Date Time Settings
How can i set the Date Time Setting Format in Control Panel

i m usiing window Xp


also i want the date format in dd/MM/yyyy

Regional Date Settings
Due to Oracle date restraints I am using this code to automatically change the users regional date settings:

Public Declare Function SetLocaleInfo Lib "kernel32" Alias _
"SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As _
Long, ByVal lpLCData As String) As Boolean

Public Declare Function PostMessage Lib "user32" Alias _
"PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long

Public Declare Function GetSystemDefaultLCID Lib "kernel32" _
() As Long

Dim dwLCID As Long

If SetLocaleInfo(dwLCID, LOCALE_SSHORTDATE, "dd-mmm-yy") = True Then
MsgBox "Failed"
End If

PostMessage HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0

I also need to change their date separator to / is there a way to do this? I f I say "dd/mmm/yy" instead of "dd-mmm-yy" it sets the date separator to /mmm/. How can just set it after setting the date format?

Regional Settings-date
how to detect whats the settings of the date for certain computer... some might have set dd/MM/yyyy while some MM/dd/yyyy....it will cause my program not to work bcos of different settings, my program is written based on dd/MM/yyyy.. i want to detect the settings of the computer running my app and if found the settings is different fr dd/MM/yy, i will change the date format to further processing the data

Regional Date Settings..
hi all...

Is there any way to change the system regional date settings through my applications...

can any one give me a sample code of it....


thanx & regards
Anu.

Regional Date Settings
Hello,

I have developed a project where in the date settings of my PC is
in US format(mm/dd/yyyy) and it works fine when we use this in
any systems with US format. But when we use the same project in
UK format(dd/mm/yyyy) my code doesn't work properly and it shows
the worng date like 2nd January is shown as 1st February. Is
there any solution that we can see the correct date though the
system formats are different irresepective of US, UK, Australia.
I am using VB 6.0.
Any help in this regard is higly appreciated.

Date Seperator And Regional Settings
Is it possible to access the system regional settings and change values in a VB6 program? I have a command button on my form and when the user clicks it, I want it to change the regional settings date seperator field from / to . or - to / etc. It would be useful if I could also change the date format ie dd/MM/yy to dd/MM/yyyy etc.

Thanks.

Irritating Date && Regional Settings
Ok my regional settings used to be "dd MMM yyyy", then some dimwit web designer said that it should be in "dd/MM/yyyy" to make one of his programs work...ive always used Datevalue in my queries which worked fine...after i changed it to "dd/MM/yyyy", they work no more...
so i read a suggestion to do this


VB Code:
Dim mydate1 As Date    Dim mydate2 As Date        mydate1 = Format(DTPicker1.Value, "mm/dd/yy")    mydate2 = Format(DTPicker2.Value, "mm/dd/yy")     Set rsx = Datacc.GetOperatorContracts(mydate1, mydate2)


GetOperatorContracts =

VB Code:
"select * from Journal, Operators " & _"Where Journal.Operator = Operators.Code " & _"AND Journal.Date Between " & "#" & DateValue(aCrit1) & "#" & _" AND " & "#" & DateValue(aCrit2) & "#" & _" Order By Journal.Descrip"


(is access database)

its just one of my queries as an example....so that worked great...then i decided to test it by changing it back to "dd/MMM/yyyy", to see if it will work on different regional settings...but alas no...so now im thinking, if my clients have different regional settings, how should i make it in either my database or program to run the query depending on their settings?

Regional Settings.............date Format
Is it possible to change the date format when a programe is loaded and then back to the origional settings when closed?

If so anyone know how?

Changing Regional Date Settings
hi,

is there any provision to change the regional date settings throgh code so that i can use my own date format. when i was using access db through vb, it is taking regional date settings instead of custom format i mentioned in the designing time of the table. hoping valuable reply

sajan

Date Format Regardless Of Regional Settings?
Hi Friends,

My system setting is 'MM/dd/yy'

i m entering in text1 as '31/03/04'

'=======================================
Private Sub Command1_Click()
If IsDate(Text1) = False Then
    Exit Sub
Else
    Text2.Text = Format(Text1, "dd/mm/yyyy")
End If
End Sub
'=======================================

Now i m expecting the date as "31/03/2004" but it results "04/03/1931"

I dont want to change date format in regional settings, but thru vb coding. pls help me.
Thanks & Regards
Mani

Regional Settings Date Format
How to change the date format in the regional settings to dd/mm/yyyy as and when my application(in vb) loads?

How To Change Date Separator In Regional Settings
can anyone tell me how to change date separator in Regional Settings with vb code?

Zillionth One About Regional Settings And Date Formats
I use a textbox to input a date as follows:

txtDate.Text = Format(txtDate, "dd/mm/yy")

At a later stage, all data in the main form including the date are stored in a Excel spreadsheet. If xlws is the worksheet, then the code line for the date is:

xlws.Cells(2, 3).Value = Format(txtDate.Text, "Short Date")

It's all intended for Spanish date format, dd-mm-yy. But when I check the worksheet every once in a while I find almost all dates incorrectly stored as mm-dd-yyyy, except those for which dd>12 so it can't represent a month.

I remember I sent a simliar post to this some time ago and the suggestion they made to me was precisely to use "short date" in the format statement. But as you see it doesn't work.

How To GET The System Date Format From Regional Settings
I have seen many posts on how to SET the date format from regional settings but none on how to just GET the date format. I don't want to change that date format because the users have other applications that are based on that setting. I just want to put in a label the format to use for entry (ex.: "dd-mm-yyyy" or "mm-dd-yyyy")

is this possible?

Changing The Date Format In Regional Settings...
How the h*ll do i change the format of the system date in
the regional settings via VB6 code?

M.

I Want To Change The Regional Settings For Currency And Date
hi there,
i would like to know how do I change the regional date and currency settings using visual basic?
thanks,
abhijit

How To Change The Date Format In Regional Settings??
Hi to all...



I want to know the procedure to change the date format in the computerwhere the application is running.
EG
Initial format.... dd/MM/yy
New format... MM/dd/yy

Any suggestion???

ESG

Windows - Regional Settings ( Date Format )
Hello Friend,

How I can set the Regional Settings Date Format Dynamically through my
application which is developed in Visual Basic.

Are there any API's for this.

Pl. Suggest Me

Regards

Prasad

Date Format, Diff. From Windows Regional Settings
Hi guys, I looked around but no answer is fitting to my problem, I use my application at the company, but there all the windows versions use date format... mm/dd/yy and I have to use dd/mm/yy

I cannot change Regional Settings there...

this is the part of my code that must be formatted. Thank you in advance.


VB Code:
datainicial = CDate(mskdep.Text)    datafinal = CDate(mskactdep.Text)    IntervaloTempo(0) = DateDiff("n", datainicial, datafinal) ' "n" for difference in minutes    lblopen.Caption = FormatTempo(IntervaloTempo(0))  End If  End Sub

Date Format That Doesn't Rely On Regional Settings
My VB program utilizes a ton of transactions on an Oracle server that involve both reading & writing.

Unfortunatley, the "Regional Settings" on a users computer must be setup the same as the regional settings on my computer, otherwise the program works, but returns no records on the screen.

This has to do with the way I'm formatting the date obviously. How do I set this up so that my program runs on any system, regardless of it's regional settings?

I have a feeling the problem is with my SQL statements, but I'm really not sure because I use the "TO_DATE" statement everywhere. I'm just a little confused as to what causes this problem, so even an explanation of the cause would help me I would imagine.

Flex Grid, Date Format And Regional Settings
I'm wondering how best to solve a date formatting issue in a flex grid.

Data is stored in an Access database. The database field is formatted as a "Long Date".

The plan is to pull the data into a flex grid control (MSHFlexGrid) and when the user clicks on a record in the grid, that record will open and provide additional information. The date is displayed in the flex grid and in the "additional information", as a DatePicker Control

Since the grid shows dates as all numeric and since I want the user to read an unambiguous date, I wrote a subroutine which uses the Format function to reformat it as d-mmm-yyyy.
Public Sub GridLongDate(Grid As MSHFlexGrid, ColumnNumber As Integer)
Dim X As Long
With Grid
For X = .FixedRows To .Rows - 1
.TextMatrix(X, ColumnNumber) = Format(.TextMatrix(X, ColumnNumber), "d-mmm-yyyy")
Next X
End With
End Sub

Here is the symptom of the problem. A date of "August 1, 2002" (in Access) looks like "8/1/2002" in the grid, prior to applying my subroutine. After my subroutine, it becomes "8-Jan-2002". BUT if I click on this row and open the full record, the date is displayed in the DateTimePicker control as "1-Aug-2002".

The subroutine etc work fine for dates such as Sept 26, dates where one number can only represent the day of the month. I can also add records without problem - it's just the grid display that is problematic.

My regional setting for short date is set to dd/MM/yyyy. But the grid displays the month first, so I'm not sure where that preference is coming from.

Any suggestions on fixing this?

Thanks!

How Programatically Change The Date Format In Regional Settings Of Windows98
I have taken maskedit text box in one of my application its format in the form is dd/mm/yyyy but if i install my application then for those fields i get a type mismatch error. but when i change the formate of date in start->settings->control panel->regional settings->date to dd/mm/yyyy my application works fine.

            pls help anyhow can i programatically change that date format in regional settings?

Another Date Problem (Regional Setting)
Hi there,

What will be the possible reason to get this 2 different output. Below mentioned is what I did.

If Adodc1.Recordset.State > 0 Then Adodc1.Recordset.Close
Adodc1.Recordset.Open "orders", Adodc1.ConnectionString, adOpenDynamic, adLockOptimistic
If Not Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
(1) Debug.Print Format(Adodc1.Recordset.Fields!orderdate, "dd-mm-yyyy")
(2) Debug.Print Format(Trim(Adodc1.Recordset.Fields!orderdate), "dd-mm-yyyy")
Adodc1.Recordset.MoveNext
Loop
End If

->ADODC1 is ADO DATA CONTROL
->Pointing to ORDERS table of NWIND and current ORDERID IS 10249
->1st Debug print gives me output as 05-08-1994
->2nd Debug print gives me output as 08-05-1994

NOTE:- My Regional Setting is [yy/dd/mm]

Thanks in Advance

Change Of Regional Setting Particularly Date
Could you help me in changing the date setting i.e. if the date setting in the system is 'd/m/yy' and i want to change the date setting in 'dd/mm/yyyy'.
Is there any API function for it.

Accepting English Format Date On Systems With French Regional Settings
This code gives me a type mismatch when I set my regional settings to French:

Dim TheDate as Date
TheDate = "Feb-10-04 20:28:24"

How can I convert "Feb-10-04 20:28:24" for a format that will be accepted under all regional settings?

I could use Replace with each month abberiation (Jan, Feb, etc...) but is there a better way?

Thanks

How Do I Apply The Regional Date Setting To A Mshflexgrid?
We use dd-MM-YYYY

The mshflexgrid uses MM-dd-YYYY

How can i apply the windows regional setting to the mshflexgrid?


Another question: I want to copy the grid content to the clipboard so i paste it in excell. Any code out there that will take care of the formats of columns?

How To Change The Regional Setting Date's Format
Hi, i need the way to change the format of regional setting date from my visual basic program, because if have dd/mm/yyyy and somebody change it to mm/dd/yy, all my programs then has an error with the format. so i need to check the date format when my application load and if it is not like dd/mm/yyyy i need to change it from my program.

.NET API Call To Get Date Format In Regional Setting
Does anyone know how could I get the Date format from the regional settings (Windows 2000) using a class from .NET platform?.

How To Chenge Date Formate In Regional Setting Form VB
Hi,
Throufh Visual basic can I set regional settings? I want to set date format from VB(dd/mm/yyyy) of regional settings.any body know any API call for that? OR any other way!!!!!

PL. help me !!

Thanks,
Venu Kumar

Change Date Format In Regional Setting Of Control Panel Through VB6
Is there any way to Change the date format in Regional Setting of
Contral Panel through VB6

thx in advance..

--


Best Regards,
Sachin Jain

Formatting A User Settings Date To A System Settings Date For Access
Hi,

I have been trying to look for this on the forums somewhere, but to no avail.

I'm sure this is a common problem for people having to write code to support different locales using Access.

When looking for records (ie when performing an SQL statement with the 'WHERE' in it, Access only returns the system settings locale (ie the US one where short date is read as mm/dd/yyyy), but any date we enter using Date or Now uses the user settings date. Forcing a Format of Now to mm/dd/yyyy does not work as it passes the user settings date.

My question is then, how can I force a date to take the system settings date so no matter what date I have it will always be Access friendly.

E.g: Here's an example

1) User settings short date: d.M.yy

2) Format (Now, "mm/dd/yyyy") returns

8.4.02 and NOT 04/08/2002, which is what Access expects.

Date$ reads the system settings date but can it be used somehow to force a user settings date ???

This is urgent. Many thanks.

Mike

Change Date Format "dd-MMM-yy" From Regional Settings
Hi Everybody,
Dear frnds i want to change date format "dd-MMM-yy" from regional settings
at run time for my application .
Can any body help me about for above situation.
Thanx in advance

Locale Setting (regional Settings)
here's the situation.

running windows 2000 and I have my locale set to English Canada. my application behaves as expected.

however, if I change to French (Canadian) I get a type mismatch error on the following code.

Function GetRate(Age As Integer, Gender As String) As Double
'gets the rate according to the age and gender
Dim RsTempRates As Recordset

Set RsTempRates = db.OpenRecordset("Select * from Rates where Age=" & Age)
Do Until RsTempRates.EOF
If Gender = "M" Then
GetRate = RsTempRates!Male 'fails here (french only)
End If
If Gender = "F" Then
GetRate = RsTempRates!Female 'fails here (french only)
End If
RsTempRates.MoveNext
Loop
GetRate = Round(GetRate, 2)

RsTempRates.Close
End Function

any ideas why this is happening and how I can fix it?

Absolute Date Date And Local Settings
I need to generate absolute date data that don't depend on the locale settings of the computer the program runs on.
I mean that date (month) should be displayed in English (for example: April, 2) and not in the language set by the user in local settings.
Can anyone help me with that?

Isa.

Convert Long Date To Short Date
Hi all,

How to convert long date format to short date format.


Ex:
    Text1.Text = FormatDateTime(Date, vbLongDate)
    Text2.Text = FormatDateTime(Text1.text, vbShortDate) ' here i am getting type mismatch error

     i am getting type mismatch error eventhough i used CDate function to convert expression to date.




Edited by - Lokesh_c on 5/17/2004 1:43:45 AM

Date Settings & Date Diff
I have a date different functions it calculates fine when in the control
format is dd-mm-yy. But I get wrong values when the date format is mm-dd-yy.

mydate=format(text1,"dd-mm-yy")

if the text1 is 25-06-2004 (Which I am selecting through date picker )

DATEDIFF("D",mydate,date) gives me -6997.

Can anyone give me good logic where it more independent from the control
panel.

Regards
Arun Rodrigues
M.A.R. Al-Bahar
P.O.Box 6038
Sharjah, U.A.E.
Phone: +971-6-5433555 ext 343
Fax : +971-6-5423769
Email : email@removed

Format Date In Long Date
In VBscript, i want to format date in long date like : 09/06/98 --> june 9, 1998

Can't Keep Regional Date In SQL
I'm using SQL to update an Access 97 database with dates. Although the VB
program calculates and displays dates in Australian Date format (dmy) the
database stores it in American (mdy).
This is not a major problem because when I retrieve the dates they are
converted back and displayed as Australian in the labels and testboxes.
Problem is that when I use SQL to find records with certain dates it skips
the dates that match (probably because literally they aren't the same with
the day and month appearing in the wrong order).
This must be a common problem but being a newbie I don't just know where to
start looking. Hope someone can be of assistance?

Change Short Date Format To Long Date Format (windows Api?)
i want that when i load my program, it will change the date settings in my computer (short date to long date). How can i do that?

Regional Date Comparison
Hi.

I get a date in the form of a string, in the format "dd/mm/yyyy" I use the Cdate function to get the date (Please note the causes terrible problems it the string is "" as well as an error). I compare this value to the system date it worked fine. Then when I changed my regional settings to US Cdate, will make 12/3/2000 --> 3rd Dec 2000 but 13/3/2000 --> 13th Mar 2000. How can I get a consistant date format irrespective of my region? Example code below.

Code:


Public Function Late(path As String, Val As Integer, Diff As Integer)

Dim InputStr As String
Dim OutputStr3 As String
Dim FileNum As Integer
Dim Day As Date
Dim Day2 As Date
Dim Day3 As String
Dim Lng1 As Long
Dim Lng2 As Long

Day = (Date - 7)
Lng1 = CLng(Format(Day, "dd/mm/yyyy"))

If Diff = 0 Then
OutputStr3 = StripData(InputStr)
If OutputStr3 = "" Then
Test = False
Else
Day2 = CDate(OutputStr3)
Lng2 = CLng(Format(Day2, "dd/mm/yyyy"))
If Lng2 > Lng1 Then
Test = True
Else
Test = False
End If
End If
Else
Line Input #FileNum, InputStr ' 6th Line
OutputStr3 = StripData(InputStr)
If OutputStr3 = "" Then
Test = False
Else
Day2 = CDate(OutputStr3)
Lng2 = CLng(Format(Day2, "dd/mm/yyyy"))
If Lng2 > Lng1 Then
Test = True
Else
Test = False
End If
End If
End If

End Function
Thank you.

Regional Date Problems
G'day,

I started this thread in database, but it belongs here.

This is the original link.
http://www.vbforums.com/showthread.p...93#post2053393

I am trying to search between 2 dates but I can't get the dates right. They are all set to my regional setting of ddmmyyyy and show that format when I debug.p them. However, if I enter this line of code into my program

Debug.Print DateDiff("d", Calendar1.Value, #18/6/2005#)
as soon as I finish typing, VB changes it to this
Debug.Print DateDiff("d", Calendar1.Value, #6/18/2005#)

I can't use the format command because my dates are showing correct and formatting them brings up strange dates.

Is there any way to tell VB to use my regional date settings?

Peter

DATE Problems - Change Date Format To European, Get Current Date, Subtract 2 Dates?
Need someone to point me in the right direction/start me off with this please as I am quite clueless on it at present...

I need something that can successfully subtract two dates...


eg. calculate the difference between the current date
02/04/04 (2nd April 04) and 29/03/04 (28th March 04)
...
which will then output a result of 5 days


So what I need to know is...

1.
I need to know how to get the current date from the system clock

2.
I must somehow get my date function converted into European date format (as at present it is in USA format ie. 2nd April 04 is 04/02/04 like April 2nd 04 which is not good!)

3.
and then I must actually SUBTRACT the 2 dates (the current date and a date that is given) from each other to give an integer which I can then use (ie. a value like 5 or 15).


But I have little idea how to go about this


Can anyone please start me off?

DATE Problems - Change Date Format To European, Get Current Date, Subtract 2 Dates?
Need someone to point me in the right direction/start me off with this please as I am quite clueless on it at present...

I need something that can successfully subtract two dates...


eg. calculate the difference between the current date
     02/04/04 (2nd April 04) and 29/03/04 (28th March 04)
     ...
     which will then output a result of 5 days


So what I need to know is...

1.
I need to know how to get the current date from the system clock

2.
I must somehow get my date function converted into European date format (as at present it is in USA format ie. 2nd April 04 is 04/02/04 like April 2nd 04 which is not good!)

3.
and then I must actually SUBTRACT the 2 dates (the current date and a date that is given) from each other to give an integer which I can then use (ie. a value like 5 or 15).


But I have little idea how to go about this


Can anyone please start me off?

From Date To Long
hello everyone, good day to you all

This is really simple (i think). How can i convert a date value to a long integer?

Long Date
How can i compare to dates formatted through long date?? A string comparision happens if they are in variables and that doesnt work right for dates

Long Date
Hi folks! Some more questions about the DTPicker here.

I have tried to use the DTPicker with the Long Date style (e.g. an entry is 4:55:00 7/7/30) but I can't seem to give the user the option to select the time. The option that appears when the user clicks the DTPicker is the display of the long date and the calendar. I need to connect the DTPicker to an SQL table with the date and time in the long format.

How can I give the user the option to select the time as well?

Thanks,

Andrew

Every Record Has A Date Field. I Want To Find A Date And From This Date, I Want To Read Records To E
Every record has a date field. I want to find a date and from this date, I want to read records to eof. What is the code? - Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved