473,567 Members | 3,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

USAGE of DateTime.GetDat eTimeFormats()

Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.To UniversalTime() .GetDateTimeFor mats()[105] to
format the string in particular format and using parseint64 after that to
generate an id after removing the - and spaces and other things.

Now, on my system

DateTime.Now.To UniversalTime() .GetDateTimeFor mats()[105] returns "09-Jan-07
06:50:07 PM"(Un Desirable) while on all other machines in our project this
returns in the format "2007-01-09 18:50:07". (Desirable Format)

How to ensure that the same value is returned in all the machines?

Regards,

Sugandh


Jan 9 '07 #1
4 32161
Not sure how to ensure the date time format is returned the same but I think
your difference in date time format is likely to be the locale settings on
the systems being different.

"Sugandh Jain" <su**********@n irvana-sol.comwrote in message
news:uP******** *****@TK2MSFTNG P02.phx.gbl...
Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.To UniversalTime() .GetDateTimeFor mats()[105] to
format the string in particular format and using parseint64 after that to
generate an id after removing the - and spaces and other things.

Now, on my system

DateTime.Now.To UniversalTime() .GetDateTimeFor mats()[105] returns
"09-Jan-07 06:50:07 PM"(Un Desirable) while on all other machines in our
project this returns in the format "2007-01-09 18:50:07". (Desirable
Format)

How to ensure that the same value is returned in all the machines?

Regards,

Sugandh



Jan 9 '07 #2
I normally do something like this, the format never changes. You should be
able to do the same with universal time.

DateTime.Now.To String("yyyyMMd dhhmmssffffff") ;

Regard,
John

"Sugandh Jain" <su**********@n irvana-sol.comwrote in message
news:uP******** *****@TK2MSFTNG P02.phx.gbl...
Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.To UniversalTime() .GetDateTimeFor mats()[105] to
format the string in particular format and using parseint64 after that to
generate an id after removing the - and spaces and other things.

Now, on my system

DateTime.Now.To UniversalTime() .GetDateTimeFor mats()[105] returns
"09-Jan-07 06:50:07 PM"(Un Desirable) while on all other machines in our
project this returns in the format "2007-01-09 18:50:07". (Desirable
Format)

How to ensure that the same value is returned in all the machines?

Regards,

Sugandh




Jan 9 '07 #3
What you have told is a nice way. but this is taking hour in 12 hour format,
but I want it in 24 hour format, because I have to it to generate ID's which
always increase in value.
How to use it in 24 hr Format does not help..
making "hh" to "hhhh"

Regards,
Sugandh

"John J. Hughes II" <in*****@nowher e.comwrote in message
news:Og******** ******@TK2MSFTN GP04.phx.gbl...
>I normally do something like this, the format never changes. You should
be able to do the same with universal time.

DateTime.Now.To String("yyyyMMd dhhmmssffffff") ;

Regard,
John

"Sugandh Jain" <su**********@n irvana-sol.comwrote in message
news:uP******** *****@TK2MSFTNG P02.phx.gbl...
>Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.To UniversalTime() .GetDateTimeFor mats()[105]
to format the string in particular format and using parseint64 after that
to generate an id after removing the - and spaces and other things.

Now, on my system

DateTime.Now.T oUniversalTime( ).GetDateTimeFo rmats()[105] returns
"09-Jan-07 06:50:07 PM"(Un Desirable) while on all other machines in our
project this returns in the format "2007-01-09 18:50:07". (Desirable
Format)

How to ensure that the same value is returned in all the machines?

Regards,

Sugandh





Jan 10 '07 #4
hh = 12 hour time
HH = 24 hour time

Regards,
John

"Sugandh Jain" <su**********@n irvana-sol.comwrote in message
news:uC******** ******@TK2MSFTN GP04.phx.gbl...
What you have told is a nice way. but this is taking hour in 12 hour
format, but I want it in 24 hour format, because I have to it to generate
ID's which always increase in value.
How to use it in 24 hr Format does not help..
making "hh" to "hhhh"

Regards,
Sugandh

"John J. Hughes II" <in*****@nowher e.comwrote in message
news:Og******** ******@TK2MSFTN GP04.phx.gbl...
>>I normally do something like this, the format never changes. You should
be able to do the same with universal time.

DateTime.Now.T oString("yyyyMM ddhhmmssffffff" );

Regard,
John

"Sugandh Jain" <su**********@n irvana-sol.comwrote in message
news:uP******* ******@TK2MSFTN GP02.phx.gbl...
>>Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.To UniversalTime() .GetDateTimeFor mats()[105]
to format the string in particular format and using parseint64 after
that to generate an id after removing the - and spaces and other things.

Now, on my system

DateTime.Now. ToUniversalTime ().GetDateTimeF ormats()[105] returns
"09-Jan-07 06:50:07 PM"(Un Desirable) while on all other machines in our
project this returns in the format "2007-01-09 18:50:07". (Desirable
Format)

How to ensure that the same value is returned in all the machines?

Regards,

Sugandh






Jan 10 '07 #5

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

Similar topics

15
4876
by: Dirk Reske | last post by:
Hello, why doesn't this code work correctly? private int GetCpuUsage(Process proc) { DateTime time1,time2; TimeSpan timediff; double cpu1,cpu2,cpudiff;
3
2602
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
33
4648
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on internet when it comes 'when to use what'. Most of articles I read from different experts and programmers tell me that their "gut feelings" for using stringBuilder instead of string concatenation...
1
1326
by: shapper | last post by:
Hello, I am taking a date/time value from a database and I need to display it as follows: , of # : And example: Saturday, 30 of September 2006 # 17:30
3
21767
by: Sugandh Jain | last post by:
What you have told is a nice way. but this is taking hour in 12 hour format, but I want it in 24 hour format, because I have to it to generate ID's which always increase in value. How to use it in 24 hr Format does not help.. making "hh" to "hhhh" Regards, Sugandh "John J. Hughes II" <invalid@nowhere.comwrote in message
6
1918
by: =?Utf-8?B?QWxsZW4=?= | last post by:
When minimizing Visual Basic application, working memory is greatly reduced from about 20 MB to only about 2 MB. However I want the application to start as minimized, and most of the time it will remain minimized, never being brought to normal or maximized view and consequently then minimized. However when started minimized the working...
7
1475
by: Eric | last post by:
I have a number of static helper methods to read in data from an IDataReader; one of the services provided by this helper class is the ability to return a nullable type as needed, for instance: public static DateTime? GetNullableDateTime(object value) {...} public static int? GetNullableInterger(object value) {...} etc. In writing tests...
1
3911
by: Kent Tenney | last post by:
Howdy, I have not found a routine to extract usable date/time information from the 60 bit uuid1 timestamp. Is there not a standard solution? Thanks, Kent
0
16481
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 formatting considerations at all. They are simple, easy, and brief and you should use them any time you need to incorporate any date literals or...
0
7686
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7588
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7903
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8115
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6272
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5216
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3630
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
930
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.