Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Formatting Dates after Date Calculations
Topic Summary:
Created On: 29-May-2003 21:52
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Debbie Shao, on Tuesday, June 3, 2003 7:23 PM

Answer:
Hi,

Thanks for your answers. I figured it out:
Using the sample code from Mike above, if you print o."Req Freeze", it'll still print in "mm/dd/yy hh:mm:ss" format. I wanted to either get it in the Default DOORS Long form, or put it in mm/dd/yy (within a Date field). So I added a few other statements to convert a date to Default DOORS Long form:


Date Target_Date = today
Date newDate
int Target_Date_int = intOf( Target_Date )
int secs_per_week = 60 * 60 * 24 * 7
int leadweeks = 5
int i = Target_Date_int - secs_per_week * leadweeks
string s = dateOf i "" <--- need this for casting
newDate = s[0:8]

This puts the date in the "dd Month yyyy" format, for example "02 June 2003".
 29-May-2003 21:52
User is offline View Users Profile Print this message


Debbie Shao

Posts: 4
Joined: 28-May-2003

Hi,
Has anyone done date calculations, such as T-5 weeks to come up with a new date? The result is that the new date has a format of "mm/dd/yy hh:mm:ss", such as "05/04/03 00:00:00". The question I have is how do you get the format to be consistent with the rest of the default DOORS dates: "dd Month yyyy". I believe the default format is called long format. The format that's coming out seems to be short format with time added.

My code does the following:

if (Tier == "1")
{
o."Req Freeze" = dateOf(intOf(Target_Date) - secs_per_week * leadweeks)
}

o.Req Freeze then has the format of "05/04/03 00:00:00". I'm trying to accomplish just getting the short date WITHOUT the time, or get the default DOORS format of "dd Month yyyy".

An alternate question would be, is there any other way to subtract 5 weeks from a date to come up with a new date, and have that date be formatted short form without the time, or the default long form?
THANK YOU FOR ANY CLUES!
Report this to a Moderator Report this to a Moderator
 30-May-2003 19:47
User is offline View Users Profile Print this message


Michael Sutherland

Posts: 248
Joined: 13-Sep-2002

Debbie,

Try it as coded below.

The "intOf()" function does not seem to work when applied directly to a Date string or Date function return value or Date Attribute return value. It does work on the contents of a Date variable. This is likely a typecasting issue. Make sure the Date of interest is put in a Date variable before being passed to the intOf() function.

Also, you will want to use the dateOf() function only after all of your integer based calculations are completed.



-------------------------
Michael Sutherland
michael@galactic-solutions.com
http://galactic-solutions.com
Report this to a Moderator Report this to a Moderator
 3-Jun-2003 19:23
User is offline View Users Profile Print this message


Debbie Shao

Posts: 4
Joined: 28-May-2003

Answer Answer
Hi,

Thanks for your answers. I figured it out:
Using the sample code from Mike above, if you print o."Req Freeze", it'll still print in "mm/dd/yy hh:mm:ss" format. I wanted to either get it in the Default DOORS Long form, or put it in mm/dd/yy (within a Date field). So I added a few other statements to convert a date to Default DOORS Long form:


Date Target_Date = today
Date newDate
int Target_Date_int = intOf( Target_Date )
int secs_per_week = 60 * 60 * 24 * 7
int leadweeks = 5
int i = Target_Date_int - secs_per_week * leadweeks
string s = dateOf i "" <--- need this for casting
newDate = s[0:8]

This puts the date in the "dd Month yyyy" format, for example "02 June 2003".

Edited: 3-Jun-2003 at 19:26 by Debbie Shao
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.