Random Date calculation formats

by michaellotter 9/20/2007 2:46:00 PM

After doing the date calculations, it got me thinking on how some of the other formatting would work and below are some of my random thoughts.  Its not much but just wanted to share it because it might help somebody starting out with SharePoint date calculations.

The value that I used for "Start Time" was 09/17/2007 and the blod date is the output and the reset is the calculation.

Changing the Month 

September 2007  =TEXT([Start Time],"mmmm")&" "&TEXT([Start Time],"yyyy")

Sep 2007  =TEXT([Start Time],"mmm")&" "&TEXT([Start Time],"yyyy")

09 2007  =TEXT([Start Time],"mm")&" "&TEXT([Start Time],"yyyy")

9 2007  =TEXT([Start Time],"m")&" "&TEXT([Start Time],"yyyy")

 

Changing the Month and Year 

September 07  =TEXT([Start Time],"mmmm")&" "&TEXT([Start Time],"yy")

Sep 07  =TEXT([Start Time],"mmm")&" "&TEXT([Start Time],"yy")

09 07  =TEXT([Start Time],"mm")&" "&TEXT([Start Time],"yy")

9 07  =TEXT([Start Time],"m")&" "&TEXT([Start Time],"yy")

 

Changing the Day

September Monday 2007  =TEXT([Start Time],"mmmm")&" "&TEXT([Start Time],"dddd")&" "&TEXT([Start Time],"yyyy")

September Mon 2007  =TEXT([Start Time],"mmmm")&" "&TEXT([Start Time],"ddd")&" "&TEXT([Start Time],"yyyy")

September 17 2007  =TEXT([Start Time],"mmmm")&" "&TEXT([Start Time],"dd")&" "&TEXT([Start Time],"yyyy")

 

Date Format 

Monday September 17th, 2007   =TEXT([Start Time],"dddd")&" "&TEXT([Start Time],"mmmm")&" "&TEXT([Start Time],"d")&"th, "&TEXT([Start Time],"yyyy")

 

Quarter Calculation 

1st Quarter 2007, 2nd Quarter 2007, 3rd Quarter 2007 or 4th Quarter 2007

=IF(AND(MONTH([Start Time])>=1,MONTH([Start Time])<=3),"1st Quarter"&" "&YEAR([Start Time]),IF(AND(MONTH([Start Time])>3,MONTH([Start Time])<=6),"2nd Quarter"&" "&YEAR([Start Time]),IF(AND(MONTH([Start Time])>6,MONTH([Start Time])<=9),"3rd Quarter"&" "&YEAR([Start Time]),IF(AND(MONTH([Start Time])>9,MONTH([Start Time])<=12),"4th Quarter"&" "&YEAR([Start Time])))))

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

MOSS

Related posts

Comments

9/21/2007 2:23:01 PM

http://

Just what I needed - thank you for sharing!!

http://

10/2/2007 4:55:56 AM

http://


Please suggest Date Calculation for finding duration between two Pick Date field by without coding (use rule or function built-in)

Thank you.


http://

10/2/2007 4:03:08 PM


Hi,

You should be able to find the duration by just doing =[End Date] - [Start Date]. This should give you the number of days that has elpased.


mlotter

10/2/2007 8:19:27 PM

http://


Thank you, mlotter. But when I used

[ToDate] - [FromDate] + 1

(pickdate control: ToDate and pickdate control: FromDate)

in insert formula then there was formula error.

The operand is not an expression.
-->[<--../my:ToDate] - [../my:FromDate] + 1

I'm not sure that I should convert my pickdate field value to datetime before.

Thank you very much.



http://

10/2/2007 9:49:46 PM


Hi,

I guess I might be a little confused in what application you're tring this in. The example that I gave you was for SharePoint calculated column type. Are you trying this in SharePoint or InfoPath?

Cheers,
Michael


mlotter

12/3/2007 3:24:07 PM

http://


I am trying to work out which Yearly Quarter an items timespan is part of. Trouble is because my code is nested the timespans that starts early are "caught" and therefor are not found if f.eks "4. quarter" is chosen.

=
IF(OR(ISBLANK([Start date]),ISBLANK([End date])),"Start date or End date missing",
IF(OR(DATEVALUE("1/1/"&[Year])>[End date],DATEVALUE("3/31/"&[Year])<[Start date]),
IF(OR(DATEVALUE("4/1/"&[Year])>[End date],DATEVALUE("6/30/"&[Year])<[Start date]),
IF(OR(DATEVALUE("7/1/"&[Year])>[End date],DATEVALUE("9/30/"&[Year])<[Start date]),
IF(OR(DATEVALUE("10/1/"&[Year])>[End date],DATEVALUE("12/31/"&[Year])<[Start date]),
"","4. quarter "&[Year]),"3. quarter "&[Year]),"2. quarter "&[Year]),"1. quarter "&[Year]))


http://

12/12/2007 10:54:48 AM

http://


Hi,

I'm trying to get a formula to calculate hours for entries in a Time Log which span over several calendar days and where a running total of the hours between the two date/times is inappropriate (eg if someone sets start date as Monday and end date as Friday then the hours would be fixed as 37.5 based on a 7.5 hour working day).

This is primarily for internal codes for things like illness or vacation.

So far I can get it so that when this happens you don't get 120 hours allotted for a Monday-Friday appointment, but it returns #NUM! not 37.5 ... can you help?

This is what we've got so far:

=IF(
NOT(ISBLANK([End Time])),
IF(
AND(Customer="Internal",(DATEDIF([End Time],[Start Time],"d")>0)),
7.5 * (DATEDIF([End Time],[Start Time],"d")+1),
([End Time]-[Start Time])*24)
,0)


http://

12/16/2007 7:53:18 AM


Hi Guy and Tim,

Sorry for not responding until know but I've been out of the country on vacation and had very limited access and very limited time to reply. I was able to reply to simple things while gone but I didn't get too your guys questions. I'll try to respond in the next couple of days. If you guys don't mind please drop me an email with your question that way I can add them to my task list.

Cheers,
Michael


mlotter

1/21/2008 4:27:53 PM

http://

Thanks for the info. My problem is a little different. I am using sharepoint data view web part in sharepoint designer. I use filtering in the common data view tasks to filter documents that are less than 30 days old. How do I go about it? I converted the date to number and subtracted 30 from it. It does not do proper subtraction of days.

http://

1/23/2008 9:54:15 AM


Hi Mandy,

Sorry for not responding sooner but my schedule has been crazy for the last few days. I've spent a little time looking into the problem that you are having and I was not able to get the filtering to work either. When I get some extra time I'll look into a little more and see if I can find a solution.

Cheers,
Michael



mlotter

2/13/2008 7:34:19 AM

http://


i`m using =text(month(date);"mmmm") to convert a date into a month`s name. But the result are wrongs, it`s returm me january instead of march and other similar error without logic.
I`m working in an spanish site, SPS 2003, and the date format is dd/mm/yyyy.
any ideas..... ?


http://

8/8/2008 5:46:52 AM

Joshua

Very informative. Thank you again for your help Michael. Your formulas helped me to set up the B & R Help Desk Ticketing site.

Joshua us

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

9/7/2008 11:58:16 PM

Powered by BlogEngine.NET 1.3.0.0
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  September 2008  >>
MoTuWeThFrSaSu
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

View posts in large calendar

Recent comments

Tags

Don't show

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in