date/time format string (help with reading and writing a specific format)

I need to read and write Date strings using the following format:
9/19/2011 8:10:58 PM

I have code that worked for years with myStreamWriter.WriteLine(Now) and DateTime.Parse(str), but now on a new machine with different locale settings the Parse is choking, and the WriteLine is using a different format.  To maintain legacy compatibility, I need to parse and write the timestamp as shown above.  I've spend a lot of time going in circles with Parse, and ParseExact, and different Format/Cluture infos, but still can't get it just right.

Any help greatly appreciated.
ottenmAsked:
Who is Participating?
 
OriNetworksConnect With a Mentor Commented:
See if any of these match your requirements.
http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm

Otherwise, I just format the date in my SQL query but im not sure if thats possible in your case.
SELECT Convert(varchar,getdate(),101) AS MyFormattedDate
0
 
OriNetworksCommented:
I think this will force it to display in US English format
.ToString(New CultureInfo("en-US"))

0
 
ottenmAuthor Commented:
No luck OriNetworks, it doesn't include the year.
0
 
ottenmAuthor Commented:
Thanks OriNetworks.  Using:

Now.ToString("M/d/yyyy h:mm:ss tt")
Dim dt As Date = DateTime.ParseExact(str, "M/d/yyyy h:mm:ss tt", Nothing)
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
yourDate.tostring ("MM\/dd\/yyyy hh:mm:ss tt",new Globalization.CultureInfo("EN-us"))
0
All Courses

From novice to tech pro — start learning today.