472,117 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,117 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 31924
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Dirk Reske | last post: by
1 post views Thread by shapper | last post: by
6 posts views Thread by =?Utf-8?B?QWxsZW4=?= | last post: by
7 posts views Thread by Eric | last post: by
1 post views Thread by Kent Tenney | last post: by
reply views Thread by leo001 | last post: by

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.