Article

vm_luotonen's picture
article
Reads:

4252

Score:
0
0
 
Comments:

1

Converting "Miliseconds Since 1970" to Readable Date Format

(View Disclaimer)

Problem

In IDM UserApp, I need to convert an attribute value saved in eDirectory as "milliseconds from 1970" to a readable date format.

Solution

Add the following code for reading the attribute into the form:

d=new Date();
d.setTime(IDVault.get(recipient,'user','endDate') *1000);
p=d.getDate()+"."+d.getMonth()+"."+d.getFullYear();

Note that the Attribute end date must be added to the Directory Abstraction Layer.


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

lcw5525's picture

i still cant return a readable date format

Submitted by lcw5525 on 24 June 2010 - 10:47pm.

d=new Date();
d.setTime((IDVault.get(null, (field.getValues()).toString(), 'user', 'DisabledDate')) *1000);
p=d.getDate()+"."+d.getMonth()+"."+d.getFullYear();

i used this code, it return some value like>> NaN NaN

why izzit it like this? how can i convert it into a readable date format?

© 2013 Novell