473,387 Members | 1,757 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,387 software developers and data experts.

datetime conversions - US CST

Hey everybody.

Is there an easy way in vb.net to convert the local time of a machine
to US CST ? My machines are distributed throughout and the server is
requesting we send the time of the txns in US CST.

TIA,
Mark
Nov 21 '05 #1
3 2601
Mark,
Unfortunately System.DateTime (VB's Date) only knows how to convert a
Universal Time to Local Time & convert Local Time to UniversalTime.

I would recommend that each of your machines convert local time to universal
time, then send that time to the server. The server can then convert the
universal time to local time which will be CST.

You can use
- DateTime.Now - to get current local date & time
- DateTime.UtcNow - to get current date & time in universal time (UTC)
- DateTime.ToUniversalTime - to convert local time to universal time
- DateTime.ToLocalTime - to convert universal time to local time
Hope this helps
Jay

"Mark" <ma*****@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Hey everybody.

Is there an easy way in vb.net to convert the local time of a machine
to US CST ? My machines are distributed throughout and the server is
requesting we send the time of the txns in US CST.

TIA,
Mark

Nov 21 '05 #2
Thanks Jay.

Unfortunately, in this environment, the server that I referred to is
not the end location and is not in CST. For this particular txn, its
just passing thru the message on to the final dest. So the server
would have the same problem. I haven't looked yet, but does the
localtime include the timezone locally also, so I would have that
information ?

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:<uG**************@TK2MSFTNGP12.phx.gbl>...
Mark,
Unfortunately System.DateTime (VB's Date) only knows how to convert a
Universal Time to Local Time & convert Local Time to UniversalTime.

I would recommend that each of your machines convert local time to universal
time, then send that time to the server. The server can then convert the
universal time to local time which will be CST.

You can use
- DateTime.Now - to get current local date & time
- DateTime.UtcNow - to get current date & time in universal time (UTC)
- DateTime.ToUniversalTime - to convert local time to universal time
- DateTime.ToLocalTime - to convert universal time to local time
Hope this helps
Jay

"Mark" <ma*****@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Hey everybody.

Is there an easy way in vb.net to convert the local time of a machine
to US CST ? My machines are distributed throughout and the server is
requesting we send the time of the txns in US CST.

TIA,
Mark

Nov 21 '05 #3
Mark,
In case you missed my point. I am suggesting you only send time in universal
time between servers. I would convert local time to universal time on the
originating systems only (not pass thru systems).

No matter what server you are on, or how many you pass thru, the time will
still be universal time. Hence there is no worry as to what the local time
is!
To answer your question, DateTime does not itself keep track as to whether
it is in Local or Universal time you need to do this yourself. I normally do
this via the context of the variable.

You can use System.TimeZone.CurrentTimeZone to find out what the current
time zone on your system is.

Hope this helps
Jay
"Mark" <ma*****@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Thanks Jay.

Unfortunately, in this environment, the server that I referred to is
not the end location and is not in CST. For this particular txn, its
just passing thru the message on to the final dest. So the server
would have the same problem. I haven't looked yet, but does the
localtime include the timezone locally also, so I would have that
information ?

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message

news:<uG**************@TK2MSFTNGP12.phx.gbl>...
Mark,
Unfortunately System.DateTime (VB's Date) only knows how to convert a
Universal Time to Local Time & convert Local Time to UniversalTime.

I would recommend that each of your machines convert local time to universal time, then send that time to the server. The server can then convert the
universal time to local time which will be CST.

You can use
- DateTime.Now - to get current local date & time
- DateTime.UtcNow - to get current date & time in universal time (UTC)
- DateTime.ToUniversalTime - to convert local time to universal time
- DateTime.ToLocalTime - to convert universal time to local time
Hope this helps
Jay

"Mark" <ma*****@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Hey everybody.

Is there an easy way in vb.net to convert the local time of a machine
to US CST ? My machines are distributed throughout and the server is
requesting we send the time of the txns in US CST.

TIA,
Mark

Nov 21 '05 #4

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

Similar topics

3
by: Martin Bless | last post by:
Below is what I'm currently using to construct datatime objects from strings. Date and time objects are made up similar. To and from string conversions are frequently needed in SQL neighborhood. ...
4
by: Max M | last post by:
# -*- coding: latin-1 -*- """ I am currently using the datetime package, but I find that the design is oddly asymmetric. I would like to know why. Or perhaps I have misunderstood how it...
16
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
4
by: GiriT | last post by:
Would appreciate some insight into how people are dealing with the implicit conversion of timezones that .NET does. If a server in one timezone delivers up a typed dataset to a component in...
11
by: Cor Ligthert | last post by:
Hello everybody, Jay and Herfried are telling me every time when I use CDate that using the datetime.parseexact is always the best way to do String to datetime conversions. They don't tell why...
5
by: iulian.ilea | last post by:
Is correct to have a varchar field and insert dates of type dd/mm/yyyy into it? I choose this method because I have an application that runs on more than one server. So, if I used a datetime field...
29
by: dyork | last post by:
When getting data from a database using the dbapi and an SQL query, how do you in general round trip the data? Especially date-time? An SQL datetime column translates nicely into a Python...
7
by: groups | last post by:
This is my first foray into writing a generic method and maybe I've bitten off more than I can chew. My intent is to have a generic method that accepts a value name and that value will be...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
2
by: Andy B | last post by:
I have a few questions about xml, DateTime conversions and DateTime fields. 1. in the example of DateTime.Now, how would you save it in the format yyyy-mm-ddThh:mm:ssZ for xml storage? 2. If I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.