473,413 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Time/Date Format Problem

I am trying to convert a string to datetime format and I get an invalid
Date/Time format error. The code I am trying to use is:

msgtime = CDate("Sat, Aug 27 2005 20:00:00 EDT")

I know I can use this format to generete a valid date but how do I correctly
covert time zones?

msgtime = CDate("Sat, Aug 27 2005 20:00:00 GMT")

Any help would be greatly appercaited.

Thanks,
Curtis
Nov 21 '05 #1
3 2161
Curtis,

If you use a datestring, than it has to be in the culture of the computer or
you have to set the culture (something I will not advice you except if you
directly set it back).

Therefore every datetime string is in almost every country in the world
different.

Is this a valid datetime string in your culture?

You know that the most nice method to get a date is using the ISO date with
new date

dim dtm as datetime = new date(2005,9,1,12,18,00)

I hope this helps,

Cor
Nov 21 '05 #2
Cor,

Thanks for the reply, so if I understand you correctly their is no way that
VB will convert times from different time zones ? My application has to
process time zones that are in the United States so does that mean I have to
process the time difference manually?

Thanks,
Curtis
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:us**************@TK2MSFTNGP15.phx.gbl...
Curtis,

If you use a datestring, than it has to be in the culture of the computer
or you have to set the culture (something I will not advice you except if
you directly set it back).

Therefore every datetime string is in almost every country in the world
different.

Is this a valid datetime string in your culture?

You know that the most nice method to get a date is using the ISO date
with new date

dim dtm as datetime = new date(2005,9,1,12,18,00)

I hope this helps,

Cor

Nov 21 '05 #3
Curtis,

Normally I have readed that the best approaches for this is to use Zulu time
(z).

That is another word for UTC which is the same as GMT time.

There is a lot written about that on internet when you search for those
three keywords.

For getting the zulu time is this keyword in the DateTime
http://msdn.microsoft.com/library/de...tcnowtopic.asp

The same is in the ToString when you see in this page for the z.

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone...
1
by: Bruce Cushman | last post by:
My DB is Access 2000 based "possibly written in 2002" and I have to send and receive update files, ported to a UNIX server by FTP, DB unknown. The file content uses a fixed length string, zero...
6
by: Mark Reed | last post by:
Hi Guru's, I have created a database to monitor hours I have worked as our payroll department are so crap. I work nights most of the time but occasionally I have to work on days. Between the hours...
3
by: Claus Haslauer | last post by:
Hi, I want to create a chart value (y-axis) vs. time (x-axis). In fact very similar to the xy(scatter) example in the graph10.chm help-file. I ran into problems, so I started a very basic *.mdb...
7
by: Edward Mitchell | last post by:
I have a number of DateTimePicker controls, some set to dates, some set to a format of Time. The controls are all embedded in dialogs. I created the controls by dragging the DateTime picker from...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
11
by: Dixie | last post by:
How can I programatically, take some Date/Time fields present in a table in the current database and change their type to text? dixie
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
10
by: WebCM | last post by:
There is a function: http://paste.ubuntu.com/21865 It needs GMT date in YYYY-MM-DD HH:MM:SS format - in SQL: datetime. If date is the same as today, the function returns "Today". There is one...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.