How can I convert integer field into date and time field ?

hemanthkumar
Kilo Expert

Hi All,

 

I have a integer field in staging table and i need convert it into date and time field after that i need to put that value in change form.

So how can I convert integer field into date and time field in SNOW ?

Any suggestions.

Regards,

Hemanth.

4 REPLIES 4

Prateek Gupta3
Mega Guru

Hi,

 

Can you please elaborate your requirement. Do you want to change your integer value to date time value using some logic?

 

Thanks,

Prateek Gupta

Hi Prateek,

 

My requirement is for remedy integration , in inbound we have some date and time fields in SNOW to that they send value in integer format those values will be stored in staging table value from that table we have fetch values and put in our change tables for that we need to write a logic to put values in date and time field on change form.

 

Thanks,

Hemnath

Hi Hemanth,

 

So here you want to parse your integer value to Date time value by using some logic.

For this please use transform map script. Use GlideDateTime class to create the Date time object. Then save that value in your change table field.

 

Hope this answers your question.

 

Thanks,

Prateek Gupta

Wirasat
Tera Guru

You can use javascript date method to covert date stored as milliseconds into date. where 100000000000 is milliseconds from  January 1, 1970.

 

var d = new Date(100000000000);
document.getElementById("demo").innerHTML = d;