473,407 Members | 2,320 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,407 software developers and data experts.

USAGE of DateTime.GetDateTimeFormats()

Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.ToUniversalTime().GetDateTimeFormats( )[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().GetDateTimeFormats( )[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 32148
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**********@nirvana-sol.comwrote in message
news:uP*************@TK2MSFTNGP02.phx.gbl...
Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.ToUniversalTime().GetDateTimeFormats( )[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().GetDateTimeFormats( )[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.ToString("yyyyMMddhhmmssffffff");

Regard,
John

"Sugandh Jain" <su**********@nirvana-sol.comwrote in message
news:uP*************@TK2MSFTNGP02.phx.gbl...
Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.ToUniversalTime().GetDateTimeFormats( )[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().GetDateTimeFormats( )[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*****@nowhere.comwrote in message
news:Og**************@TK2MSFTNGP04.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.ToString("yyyyMMddhhmmssffffff");

Regard,
John

"Sugandh Jain" <su**********@nirvana-sol.comwrote in message
news:uP*************@TK2MSFTNGP02.phx.gbl...
>Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.ToUniversalTime().GetDateTimeFormats( )[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().GetDateTimeFormats ()[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**********@nirvana-sol.comwrote in message
news:uC**************@TK2MSFTNGP04.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*****@nowhere.comwrote in message
news:Og**************@TK2MSFTNGP04.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.ToString("yyyyMMddhhmmssffffff");

Regard,
John

"Sugandh Jain" <su**********@nirvana-sol.comwrote in message
news:uP*************@TK2MSFTNGP02.phx.gbl...
>>Hi,

I am using dotnet framework 2.0, visual studio 2005.

We are using DateTime.Now.ToUniversalTime().GetDateTimeFormats( )[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().GetDateTimeFormat s()[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
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
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
33
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...
1
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
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...
6
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...
7
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:...
1
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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.