Date and hour arrangement

  • Thread starter mohsin via AccessMonster.com
  • Start date
M

mohsin via AccessMonster.com

Hi all

Apperiacite for your help,
I have list of date and hour with below format

dd.mm.yyyy hh:mm:ss am/pm
dd.mm.yyyy

for dd.mm.yyyy is belong to hr 00:00:00,

so my question here, i'm using this queries to get hourly;

Hour: IIf(Trim(Mid([PERIOD_START_TIME],12,2)) Is Null,"00",Trim(Mid(
[PERIOD_START_TIME],12,2)))

this queries is to get, when "dd.mm.yyyy" put 00, else put hh, but seems like
wrong queries, due to result is still NULL for non hh, but with hh is working
good.

please correct me.

thank very
-mohsin
 
M

mohsin via AccessMonster.com

I'm using also Datepart("h",[field]),
return with 0, but for some hrs like 01, the queries gaves 13,,

Hi all

Apperiacite for your help,
I have list of date and hour with below format

dd.mm.yyyy hh:mm:ss am/pm
dd.mm.yyyy

for dd.mm.yyyy is belong to hr 00:00:00,

so my question here, i'm using this queries to get hourly;

Hour: IIf(Trim(Mid([PERIOD_START_TIME],12,2)) Is Null,"00",Trim(Mid(
[PERIOD_START_TIME],12,2)))

this queries is to get, when "dd.mm.yyyy" put 00, else put hh, but seems like
wrong queries, due to result is still NULL for non hh, but with hh is working
good.

please correct me.

thank very
-mohsin
 
J

John Spencer

13 is 1 PM
1 is 1 AM

When you return the hour the result should return 0 to 23.

You can return just the hour as a string using the format function
FORMAT([Period_Start_Time],"hh")
will return a two character string from 00 to 23.

If [Period_Start_Time] is null, the function above will return a zero-length
string.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

mohsin via AccessMonster.com said:
I'm using also Datepart("h",[field]),
return with 0, but for some hrs like 01, the queries gaves 13,,

Hi all

Apperiacite for your help,
I have list of date and hour with below format

dd.mm.yyyy hh:mm:ss am/pm
dd.mm.yyyy

for dd.mm.yyyy is belong to hr 00:00:00,

so my question here, i'm using this queries to get hourly;

Hour: IIf(Trim(Mid([PERIOD_START_TIME],12,2)) Is Null,"00",Trim(Mid(
[PERIOD_START_TIME],12,2)))

this queries is to get, when "dd.mm.yyyy" put 00, else put hh, but seems
like
wrong queries, due to result is still NULL for non hh, but with hh is
working
good.

please correct me.

thank very
-mohsin

--
Cheers
Mohsin

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top