cancel
Showing results for 
Search instead for 
Did you mean: 

How to covert milliseconds to UTF date format to verify from DB

SOLVED
Highlighted
Occasional Visitor

How to covert milliseconds to UTF date format to verify from DB

When I send request I am getting response in milliseconds [1576522684000], how can I covert it to UTF date format 2019-12-16-13:58:06.070000 to validate my request and DB response. Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: How to covert milliseconds to UTF date format to verify from DB

Hey @ramzsvs

Sorry, i only just noticed this ticket, f youre still struggling, try this

def milval=testCase.getPropertyValue("valuepropname").toLong

log.info new Date(milval).format("yyyy-MM-dd'T'Hh:mm:ss.SSS'Z'")



Ta

Rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

View solution in original post

3 REPLIES 3
Highlighted
Contributor

Re: How to covert milliseconds to UTF date format to verify from DB

You can search google for how to do this. If you want to do the conversion with a Groovy script, then here are the keywords I would use - "java convert milliseconds to utc date". You can try using groovy instead of java also, but java will give more results. We can use java libraries inside our groovy scripts.

Similarly, if you wanted to do the conversion with sql instead, you can search for "sql convert milliseconds to utc date". You can also mention the dialect of sql you are using such as sql server, mysql etc.

Here are all the java based google search results from stackoverflow:
https://www.google.com/search?q=java+convert+milliseconds+to+utc+date+site:stackoverflow.com

good luck!

Highlighted
Community Manager

Re: How to covert milliseconds to UTF date format to verify from DB

Thanks for your help, @rajs2020!

 

@ramzsvs, did this suggestion help? Please let us know if you are still looking for the solution.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Hero

Re: How to covert milliseconds to UTF date format to verify from DB

Hey @ramzsvs

Sorry, i only just noticed this ticket, f youre still struggling, try this

def milval=testCase.getPropertyValue("valuepropname").toLong

log.info new Date(milval).format("yyyy-MM-dd'T'Hh:mm:ss.SSS'Z'")



Ta

Rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors