Solved

.NET: How to check whether a time is AM or PM

Posted on 2008-10-14
2
203 Views
Last Modified: 2013-12-17
Hi, I there any way I can check whether a time is AM or PM in C#? Or I have to do all the logic myself?
0
Comment
Question by:karakav
2 Comments
 
LVL 1

Accepted Solution

by:
MarkMyburgh earned 500 total points
ID: 22709856
not sure, but i suppose a simple hack would be

DateTime x = new DateTime(2008, 1, 1, 14, 0, 0);
bool am = x.TimeOfDay.Hours >= 13 ? false : true;
 
0
 
LVL 4

Author Closing Comment

by:karakav
ID: 31505818
Thanks. That's exactly what I needed. But Correct it this way: bool = x.Value.TimeOfDay.Hours >13?false:true;
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now