This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Feb 13, 2012, 1:27 PM
46 Posts
topic has been resolvedResolved

Week number

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: End user,Developer
  • Tags:
  • Replies: 4
How to get week number when the document was created?

Feb 14, 2012, 2:28 PM
272 Posts
Re: Week number
Hi,
 
try this SSJS:
 
var doc:NotesDocument = database.getAllDocuments().getFirstDocument();
var date:NotesDateTime = doc.getCreated();
var cal = java.util.Calendar.getInstance();
cal.setTime(date.toJavaDate());
week = cal.get(java.util.Calendar.WEEK_OF_YEAR);
week
 
Hope this helps
Sven
 
Feb 15, 2012, 9:50 AM
46 Posts
Re: Week number
Hallo Sven, your script works but I do not know why for date 15.02.2012 gives me that it's a week 6.
Feb 15, 2012, 9:51 AM
272 Posts
Re: Week number
You have to increase by one. For the first CW a zero is returned, etc.
15.02.2012 is in CW 7 (6+1)
 
Sven
 
Feb 15, 2012, 10:46 AM
46 Posts
Re: Week number
Thanks Sven, now everything is working properly:
 
var doc:NotesDocument = database.getAllDocuments().getFirstDocument();
var date:NotesDateTime = doc.getCreated();
var cal = java.util.Calendar.getInstance();
cal.setTime(date.toJavaDate());
week = cal.get(java.util.Calendar.WEEK_OF_YEAR);
week + 1

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal