Skip to content
sneppets

sneppets

  • Privacy
add hours to timestamp unix 2

How to add hours to unix timestamp or epochmilli in java?

February 4, 2020February 12, 2020 Editorial StaffLeave a Comment on How to add hours to unix timestamp or epochmilli in java?

This tutorial explains how to add hours to unix timestamp or epochmilli using TimeUnit in Java. You may face situations like adding hours, minutes and seconds to an timestamp for display purpose in UI. Let’s see how to do that.

Java hours, java, timestamp
sneppets-java8

Format LocalDate to String or int with Month and Day in double digit

January 30, 2020February 12, 2020 Editorial StaffLeave a Comment on Format LocalDate to String or int with Month and Day in double digit

Let’s say you wanted to format LocalDate like yyyyMMdd with date’s month and day values in double digit to String or int, then follow this tutorial.

Java Calendar, Date, java, LocalDate
sneppets-java8

Check if Element exists in a Collection using Lambda Expressions

January 29, 2020February 12, 2020 Editorial StaffLeave a Comment on Check if Element exists in a Collection using Lambda Expressions

If you wanted to check whether element exists in a collection or not using specific id or name, the better approach is to use anyMatch() method of Stream interface of Lambda Expressions.

Java java, java-8, lambda

How to build maven project without version

December 15, 2019February 12, 2020 Editorial StaffLeave a Comment on How to build maven project without version

If you wanted to build maven project without the version details mentioned in your pom file, then you need to follow the below instructions.

Java java, maven

JSONException : A JSONObject text must begin with ‘{‘ at 1 [character 2 line 1]

December 14, 2019February 12, 2020 Editorial StaffLeave a Comment on JSONException : A JSONObject text must begin with ‘{‘ at 1 [character 2 line 1]

Are you getting error “A JSONObject text must begin with ‘{‘ at 1 [character 2 line 1]” while parsing JSON response. First you need to check whether JSON string/response is valid or invalid JSON.

Java java, JsonObject, org.json.JSONObject

Posts navigation

Older posts
Newer posts
Copyright © 2018 Sneppets. All Rights Reserved