Hi I have a datetime of the following format:
08/12/2010 08:24:01 AM
i can obtain the date parts
datetime("08/12/2010 08:24:01 AM")
int year = datetime("08/12/2010 08:24:01 AM").Year
int mm = datetime("08/12/2010 08:24:01 AM").Month
int hh = datetime("08/12/2010 08:24:01 AM").Hour
int min = datetime("08/12/2010 08:24:01 AM").Minute
int ss = datetime("08/12/2010 08:24:01 AM").Second
problem
when it is the PM
datetime("08/12/2010 08:24:01 PM")
then the time value is military time i.e 18 hours
is there a way to naturally obtain the standard time 08 and obtain the PM and AM.
i could do a if HH = 18 then
hh = 08
ampm = pm
but that seems like it would be a long way around.
so basically i want to obtain 08 and AM or PM with going through the above IF THEN scenario.
thanks in advance
dp.SyntaxHighlighter.ClipboardSwf = ‘/dp.SyntaxHighlighter/Scripts/clipboard.swf’
dp.SyntaxHighlighter.HighlightAll(’743aee59997c4fd29a9b0a4a49ee512a’)
Similar:
- C# DateTime Parsing Problem Hi, My current code looks like this: DateTime dateBegin = DateTime.ParseExact(begin, "MM/dd/yyyy", null); DateTime dateEnd = DateTime.ParseExact(end, "MM/dd/yyyy", null); But it throws an exception whenever...
- Comparing if datetime.datetime exists or None I’m running a small app on Google App Engine with Python. In the model I have property of of type DateTimeProperty, which is datetime.datetime. When...
- How to get DateTime stamp of a textfile using VB 6 How do you obtain the DateTime stamp of a textfile using VB 6.0? By DateTime stamp I mean the date & time the textfile was...
- How do I translate a ISO 8601 datetime string into a Python datetime object? I’m getting a datetime string in a format like “2009-05-28T16:15:00″ (this is ISO 8601, I believe) one hack-ish option seems to be to parse the...
- c# datetime timezone issues Dear Sirs, I’ve looked and looked and can’t seem to come up with the perfect solution. So, since CodeProject is perfect, this will cure my...