Changing System Date

techieit

New member
Joined
Aug 23, 2005
Messages
4
Programming Experience
1-3
hello all !
i have an app in which i have to change the system date to a specific format.using vb.net how can i accomplish this???
i would want to write the code in the load event
please advice

gopi
mumbai
 
Are you asking how to change the system's date value or the format in which the system displays dates? Are you aware that you can display dates and times however you want within your own app without having to change the system settings?
 
Hi

i can explain the problem i am facing

i have an app that reads a DAT file and stores the data in the DB . the reading is done line by line and after each read opeartion , write operation is done into the DB . My app is demainding a certain date format.So i go to regional settings and change the defualt format into the required format i want or my app id demanding. It works fine for the first time.
But , when my client loads another app which might demand another date format .the required is changed.
So once again , once my app is loaded , it doesnt work coz , the format is wrong and i get an err

So what i was thinkking is , when my app is loaded , it changes the System Date format to the format which is desired

thanks
gopi
 
When talking about formats with regards to dates, it only applies to string representations of dates. The internal represenation of DateTime objects is always the same. Format only becomes an issue when converting a DateTime object to a String, like when it is displayed, or when converting from a String, like when parsing a text file. If you are reading dates from a file and you know what format they will be in, you can use DateTime.ParseExact to read a string into a date object regardless of what the system settings are. For instance, if your file contained dates formatted like 2005.08.30 you would simply use code like:
VB.NET:
myDateTime = DateTime.ParseExact(myString, "yyyy.MM.dd", Nothing)
Does this sound like it would be useful, or is it possible that the dates in the data file will not be in a specific format?
 
Back
Top