Custom Date Fields

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
DAWPage
Posts: 14
Joined: Fri Feb 07, 2014 10:26 am

Custom Date Fields

Post by DAWPage » Mon Feb 24, 2014 10:16 am

We have a custom date field for our items. I am working on a custom report on the data, I need to know how to pull the data from the custom field, the data I see is '635288148000000000'

Thanks,

David Williamson

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Custom Date Fields

Post by lbauer » Mon Feb 24, 2014 2:33 pm

What are you using to pull the data?

The Vault Pro API?
Linda Bauer
SourceGear
Technical Support Manager

DAWPage
Posts: 14
Joined: Fri Feb 07, 2014 10:26 am

Re: Custom Date Fields

Post by DAWPage » Mon Feb 24, 2014 2:35 pm

From a view in the database.

mskrobul
Posts: 490
Joined: Wed Jan 14, 2004 10:22 am
Location: SourceGear
Contact:

Re: Custom Date Fields

Post by mskrobul » Mon Feb 24, 2014 5:06 pm

Custom field dates are stored in the database as .NET UTC ticks. For example to convert the database value to a date in C# you would first convert the string to a long, then use that value to create a DateTime object:

Code: Select all

 
//get the stringTicks from the database
//convert the string to a long
long longTicks = long.Parse(stringTicks);

//Create a UTC date time from the ticks
DateTime date = new DateTime(longTicks, DateTimeKind.Utc);

//or if you want a local date
DateTime date = new DateTime(longTicks, DateTimeKind.Utc).ToLocalTime();
Mary Jo Skrobul
SourceGear

Post Reply