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: Setting different short date formats
Topic Summary:
Created On: 2-Oct-2008 14:51
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.
 2-Oct-2008 14:51
User is offline View Users Profile Print this message


Ryan Maloney

Posts: 5
Joined: 21-Aug-2008

Is anyone familiar with setting different date formats with dxl? I'm writing to a file from a buffer and I'd like to change the output date format... A function is referenced in the dxl manual called 'setDateFormat(Locale)' but I'm not able to get it to work. Any ideas??

Thanks!
Report this to a Moderator Report this to a Moderator
 2-Oct-2008 15:56
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

If you have a date you want to write out, use the stringOf(Date d, string s) function.

The string should be of a supported format.

For October 2, 2008 use "MMMM d, yyyy"
For 10/02/08 use "MM/dd/yy"
For Oct 2, 2008 use "MMM d, yyyy"

Most American and UK standard ways of writing dates are supported.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 2-Oct-2008 16:19
User is offline View Users Profile Print this message


Ryan Maloney

Posts: 5
Joined: 21-Aug-2008

I can get that to work fine, but it's within the 'write()' command where I'm having trouble. I'm writing out to an Excel file and I'd like to get the date included in the file name. The only date commands that won't produce an error when writing are 'today()' and 'dateOnly()'. But those two commands both spit out '02 October 2008', so I thought maybe I could change the short date format in the locale directly within the script.

A format such as 'M/d/yyyy' or 'MM/dd/yy' is what i was hoping for, but here's the code as of now...
Report this to a Moderator Report this to a Moderator
 2-Oct-2008 17:10
User is offline View Users Profile Print this message


Douglas Zawacki

Posts: 58
Joined: 17-Oct-2006

the backslash is not allowed in a filename. You will need to replace the backslashes with something else like a hyphen. I believe that should get you the filename format you are looking for.

Edited: 2-Oct-2008 at 20:12 by Douglas Zawacki
Report this to a Moderator Report this to a Moderator
 2-Oct-2008 22:38
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

So do stringOf(today, "MM/dd/yy")

Or for hyphens do stringOf(today, "MM-dd-yy")

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 2-Oct-2008 at 22:39 by David Pechacek
Report this to a Moderator Report this to a Moderator
 3-Oct-2008 16:50
User is offline View Users Profile Print this message


Ryan Maloney

Posts: 5
Joined: 21-Aug-2008

Thanks Doug, I completely disregarded what characters are not allowed when writing my script. Here's what I ended up with for writing the file name...

It sets the date format to MMM-dd-yyyy, and then changes the time format by replacing the colons with 'dot' characters...
Report this to a Moderator Report this to a Moderator
 7-Oct-2008 16:45
User is offline View Users Profile Print this message


Douglas Zawacki

Posts: 58
Joined: 17-Oct-2006

Cool,

Good point David, I completely had a brain lapse on that one. That's what I get for typing too quickly without thinking

Ryan,

I just wanted to point out that using the format "MM-dd-yyyy" in your file names may cause you a bit of grief when you are dealing with files from multiple years....They will not sort properly. That's why I like the format "yyyy-MM-dd" The sorting works best for me.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.