473,499 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem in DATE-TIME (c#) formatting, Help me plz..,

nirmalsingh
218 New Member
hi, my code is
-------------------
string demo="01-01-2007 04:59:21 PM";
DateTime dtDate=Convert.ToDateTime(demo);
string strDate = dtDate.ToString("yyyy-MM-dd hh:mm:ss AM/PM");
-------------------

i want to convert the date in above string (demo) , to 2007-01-01 04:59:21 PM

am or pm is not accepted and also internal server error is displayed. what to do? help me with sample code plz.
Jan 8 '07 #1
4 1440
kenobewan
4,871 Recognized Expert Specialist
This article may help:
Date and Time
Jan 8 '07 #2
nirmalsingh
218 New Member
thanx but its in html, i need the sample coding in c#, boss.
Jan 8 '07 #3
kenobewan
4,871 Recognized Expert Specialist
Oops... try this one:
Formatting Date and Time Values In .NET
Jan 8 '07 #4
nirmalsingh
218 New Member
ok with that but am or pm is not considered, by default it assigns am for pm also. what to do..?
Jan 9 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1146
by: OllimaX | last post by:
Hi all you fine people! I tried to view older messages, but couldn't find a match with my present problem. Please see an example of the original xml. As you can see, the order of elements is...
11
2040
by: Aing | last post by:
Anyone knows what can be cause of this problem? //////////////////////////////////////////////////////////// typedef struct _date_struct { int date,month,year; }date_struct; Class Date {...
7
2826
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
11
4198
by: David B | last post by:
I have 2 querys with the following in the date criteria Between DateAdd("m",-6,(!!)) And (!!) Between DateAdd("m",-24,(!!)) And DateAdd("m",-6,(!!)) Problem is they both look at the same...
14
1888
by: marcokrechting | last post by:
Hi All, I have a rather complex math problem concerning dates. I will try to explain my problem. I have a table with the fields SUBJECT (text), DUE DATE (date) and CHECKED (yes/no). In this...
13
10677
by: Jim Armstrong | last post by:
Hi all - This problem has been driving me crazy, and I'm hoping the answer is something stupid I am neglecting to see.... The procedure posted below is part of an Access/SQL database I have...
2
1483
by: DeanL | last post by:
Hi all, I have a problem that I'm a little stumped by and need some help if possible. I need to generate a report in Access 97 from 2 tables (easy so far) but it requires a calculated date...
8
2439
by: sara | last post by:
I have a report that runs fine with data. If there is no data, I have its NO Data event sending a MsgBox and cancelling the report. Then it seems I still get the 2501 message on the Open Report...
0
1017
by: mykhan | last post by:
I have been using access database with asp.net pages. I just realized a problem with date saving in access table. I didnt give any specific format for the date when saved in tables, because I wanted...
5
3669
by: Kasrav | last post by:
I have another problem hopeful am not bothering you guys too much if u can help that would be wonderful. I have this code here def year2(): print'This program validates days and months of the...
0
7174
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
7220
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...
1
6894
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
7388
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
5470
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,...
1
4919
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...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
297
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...

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.