2,656 questions
-1
votes
0
answers
50
views
Ordinal day of month in kotlin [duplicate]
I'm trying to figure out how to get a more complete date in kotlin, not just something that says Tue, Jan 1 but has the ordinal part of the day, so Tue, Jan 1st I have tried searching ordinal date in ...
1
vote
0
answers
85
views
Indonesia java date format "Agt" [duplicate]
Currently, in Java I have tested using IBM SimpleDateFormat and Java DateTimeFormat, both cannot parse "Rab, 25 Agt 2025" due to IBM and Java only recognize "Agu"
Is there any ...
5
votes
1
answer
191
views
Reading a string in java to proper Date format [duplicate]
I have a string:
String inputDate = "18-FEB-24 10.02.33.578000000 AM";
I am trying to read it back and format it in YYYY-MM-DD HH:mm:ss.SSSSSS.
I tried the SimpleDateFormat as well as ...
3
votes
3
answers
304
views
SimpleDateFormat working on Non-English Locale(Nepali or Devnagari)
I am having confusion on understanding the following piece of code:
public static void main(String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...
3
votes
3
answers
157
views
Android SimpleDateFormatter Parse Exception
I have some old Java code that attempts to parse a string using SimpleDateFormat. It is frequently throwing a ParseException:
Non-fatal Exception: java.text.ParseException: Unparseable date:
"06:...
0
votes
0
answers
96
views
ERROR: date/time field value out of range: "2024-02-12 170000892" SQL state: 22008
I have the below query:
INSERT INTO TEMP_USAGE_REPORTING
(SELECT ABC.EPCCLASS_ID, ABC.EPCCLASS_SEARCH_PAT, ABC.SERIAL, ABC.EVENT_RECORD_DT, ABC.EVENT_RECORD_TM
FROM
(SELECT EVENT_EPC....
-2
votes
1
answer
139
views
Possible values to be parsed using SimpleDateFormat
Sorry to ask if this is a duplicate question as I try to find solutions online but couldn't get a confirmed answer.
I would like to know the possible values that can be used to parse using ...
-2
votes
2
answers
232
views
Change date format DatePickerDialog- Android studio Java
Does anyone know how to change the date format in DatePickerDialog in Android studio in Java, I need like "Mon, May 6" I need like this format instead of "M05 6, Mon"Image link .
...
0
votes
0
answers
82
views
How might my API be receiving an incorrectly formatted ISO 8601 timestamp
I have an iOS/Android app sending data to the Python backend.
In both apps, the user selects a date and time from a picker, and it is sent to the server:
Android:
SimpleDateFormat simpleDateFormat = ...
2
votes
1
answer
158
views
SimpleDateFormat gives a wrong date when input a wrong format date string
code is
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = format.parse("2024-03-01 09:20:46");
the date's value is Sun Dec 03 00:01:09 ...
0
votes
1
answer
94
views
Execute Date arithmetic without daylight saving adjustment
I want to parse a Date from a String in NYC timezone, add 1 day and then output string.
like:
parse to date
add 1 day
output
The problem is, that when I parse a date during the adjustment for ...
2
votes
1
answer
725
views
I got the error "java.text.ParseException: Unparseable date: "1/10/24 7:00 PM"" when trying to parse
I have a date string as "1/10/24 7:00 PM" (10th Jan.2024). How to parse it using SimpleDateFormat?
String date_time = "1/10/24 7:00 PM";
Instant answer;
try {
answer = Instant....
1
vote
3
answers
832
views
Parse string date to millis in kotlin
I am using SDF to parse a string date to millis with below code
private fun dateToMilliseconds(dateValue: String): Long? {
val sdf = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS")
val date: ...
-1
votes
2
answers
117
views
How to convert a string with extra characters
How to convert a string with extra characters
String str = "file-09-01-2024"
pattern = "dd-MM-YYYY"
using SimpleDateFormat with pattern = "dd-MM-YYYY"
I don't know how ...
0
votes
0
answers
123
views
Unparseable date Exception on Unit Testing via Mockito
In my case, i am in need of get the string date as format i prefer , below is the exact code i am using to get the return date as string
Below is the Test Function:
@Test
fun `get formatted server ...
0
votes
1
answer
153
views
Why is Java epoch time off by 30 minutes when parsing via SimpleDateFormat
Somehow parsing date time strings and converting them to milliseconds after the epoch works differently in different environments. It would seem something is off with the timezone or something. In ...
1
vote
2
answers
139
views
Calendar Class method in Java seems to be not giving correct result [duplicate]
Can someone please explain why is the behavior of the below piece of code not as expected.
import java.util.Calendar;
import java.util.Date;
import java.text.SimpleDateFormat;
public class Test {
...
2
votes
2
answers
117
views
Date Pattern starting from 12 hours
I'm trying to convert two dates into this pattern: yyyy-MM-dd HH:mm:ss.SSS.
I need to retrieve two dates:
Last year, same month, day 1, 00:00:00.000
Last day of previous month, 23:59:59.999
So, as ...
-2
votes
2
answers
543
views
How to convert Date from 2023-11-10 09:44:00.038860 to 2023-11-10T09:44:20.001+00:00 in spring boot application
I am getting response from ELK and mapping it to an object using ObjectMapper and then return the response as JSON. The ELK response has a Date datatype field with the format yyyy-MM-dd HH:mm:ss....
0
votes
2
answers
436
views
Simple Date format not recognised
I am on Windows 10 with Java 17 using Simple Date Format.
I am trying to get a date format like 2023-10-12 21:26:16 but instead I get 2023-Oct-12 21:26:16. The date is inside a Jackson 2.15 ...
3
votes
1
answer
332
views
Date Parse Exception in Android for input Mon, 11 Sep 2023 15:49:32 GMT
fun calculateAge(dateString: String): String {
val dateFormat = SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z")
dateFormat.timeZone = TimeZone.getTimeZone("GMT")
...
0
votes
1
answer
388
views
SimpleDateFormat string parsing issue in a Specific Android Device [duplicate]
I have a released android app and a strange issue has cropped up with a specific device. On analysis of Crashlytics data, I found that the app is crashing for this particular user (and device) because ...
0
votes
0
answers
74
views
Converting Server GMT date and time to User specified date and time zone with specified format, returning with Date datatype [duplicate]
I am trying to convert the Date received from Server to user specific date format (IST) and returning as Date datatype. Attached the sample code and result as below
import java.text.SimpleDateFormat;
...
0
votes
3
answers
5k
views
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); customize the timezone
I want to print the date with the char ":" in the middle of timezone,
example :
2023-08-02T14:19:10+02:00
At the moment I am using this pattern:
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:...
0
votes
1
answer
204
views
Is this a bug in SimpleDateFormat, or a feature? [duplicate]
I recently changed... continents and temporarily forgot to signify July 27th 2023 in the European way, i.e "27/07/2023", and instead maintained the American - style literal "07/27/2023&...
-1
votes
2
answers
1k
views
How to convert date from this format "dd/MMM/yyyy" to any other format with Java 17 version?
I am trying to convert date from this format "dd/MMM/yyyy" to "yyyyMMdd",
for Java 1.8 version ,the code was working fine, my code is
SimpleDateFormat inputFormat = new ...
1
vote
1
answer
301
views
SimpleDateFormat("MMM d, yyyy") returns Weekday Month day 00:00:00 EDT year [duplicate]
I have a String List [Apr 1, 2019, Aug 1, 2020, Feb 20, 2018] which i need to convert to Date format in the same pattern. When Im doing it with SimpleDateFormat("MMM d, yyyy") pattern Im ...
-1
votes
2
answers
653
views
Cannot parse date containing GMT to Timestamp in Java (Unparseable date Issue)
I cannot convert the date containing GMT to timestamp in Java
Here is the code shown below
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java....
0
votes
0
answers
64
views
Need alternative for toJavaDatePattern method from HsqlDateTime class from jar - hsqldb-2.3.1
Need alternative for toJavaDatePattern method which is available in HsqlDateTime class from jar - hsqldb-2.3.1.
Method usage - Converts the given format to pattern acceptable by SimpleDateFormat.
...
0
votes
1
answer
186
views
Why ParseException is not caught?
Why is ParseException not caught here? When I enter a date consisting of more than 4 digits it just accepts it, but it shouldn't as I set lenient to false. When I enter letters for the year I get ...
-3
votes
2
answers
591
views
How to convert different date formats in JDK11 to dd-mm-yyyy format? [duplicate]
I have a use case where I have date in the following formats,
2023-05-09T05:55:07Z
2023-04-30
08-05-2023
2023-05-09 00:00:00
31-Dec-2021
Irrespective of the input format I have a requirement to ...
0
votes
1
answer
117
views
How to format a date inside a String with Java? [duplicate]
I have a String that receives the following date format (yyyy-MM-dd ...)
"2023-03-13 12:00:02"
and i need to change the format to the following (dd-MM-yyyy ...)
"13-03-2023 12:00:02....
0
votes
4
answers
2k
views
Converting UTC to Local Time with daylight saving in Java
I am trying to convert UTC time to local time, including daylight saving.
Localtime (Stockholm), in summer, should be 2 hours ahead of UTC, but when I convert it in Java it only adds one hour.
public ...
0
votes
1
answer
182
views
Why are months one less than the selected value when using DatePickerDialog in Kotlin?
I'm developing an Android app in Kotlin, and I'm using the DatePickerDialog to allow the user to select a date. However, I've noticed that when the user selects a month, the value passed to the ...
0
votes
2
answers
264
views
Converting time into number of seconds? [duplicate]
I am using simple date format to convert the following into number of seconds
Input : 00:00:10.000 , 00:05:10.000, 01:00:23.000
Expected output : 10 seconds , 310 seconds , 3623 seconds
Below is how I ...
1
vote
1
answer
105
views
SimpleDateFormat is giving wrong hours and seconds data
I'm using SimpleDateFormat to get the hours and seconds in this format "HH:MM a" for 2 dates in same function. The output printing is same for both of them and it is mostly of the first date....
-1
votes
2
answers
90
views
Parse string date Unparseable date java
I'm trying to parse a String date like :Mon Dec 28 15:18:16 2021 into some thing like this: yyyy-MM-dd HH:mm:ss z. This is my code.
public void parseDate(String stringDate) throws ParseException {
...
0
votes
2
answers
155
views
How to convert a date into another date as a String in Java?
I want to convert a date format into another date format. For example, I have this String "05-Apr-23" and I want to convert it into this String "05/04/23". And I did this ...
-2
votes
3
answers
1k
views
Convert Date to UTC DateTime
I have the date 2023-04-03 and wanted to convert it into UTC time with range (start and end of the day)
2023-04-03T00:00:00 -> 2023-04-02T18:30:00z
2023-04-03T24:00:00 -> 2023-04-03T18:30:00z
...
1
vote
5
answers
497
views
Issue when comparing date with Java
I am encountering some issues right now when I compare two dates in Java.
I want to check that a date is the same day on the next week that today.
First, I am doing this:
SimpleDateFormat sdf =...
0
votes
2
answers
1k
views
Java SimpleDateFormat returns incorrect date [duplicate]
Im working with some dates in Java. Trying to parse some string date inputs to Date objects.
This is done using SimpleDateFormat.parse(String date).
When I use the SimpleDateFormat of "yyyyMMdd&...
-2
votes
1
answer
97
views
How to convert dd/MM/yyyy into dd/mm/yyyy in JavaScript? [closed]
I have a date field on which I am calling datepicker in the following format :
$(function() {
$('.dob').datepicker({
dateFormat: 'dd/MM/yyyy',
});
});
When the user selects ...
-4
votes
2
answers
3k
views
Is there any other way to convert "timestamp = System.currentTimeMillis()" to normal date time, say for example "DD-MM-YYYY HH:MM:SS"
Actually we are using a "timestamp = System.currentTimeMillis()", which is an Epoch time! We are looking to convert the same to normal format ex: 15-03-2020 (dd-mm-yyyy).
We are using:
...
0
votes
2
answers
57
views
The date obtained by sprigboot console is inconsistent with the date obtained by the browser
When I get a timestamp date data from the database, I convert it to the format I want through simpledateformat, and everything is normal here, and the date and time are correct when I test it with ...
-4
votes
1
answer
278
views
Convert PST date millis to UTC millis [closed]
In a data stream, I'm receiving date attribute values in milliseconds in Pacific timezone. Like for date = Wed Jan 18 2023 18:00:00 Pacific Time, I'm receiving milliseconds value as 1674064800000. It ...
0
votes
0
answers
156
views
How to use SimpleDateFormat week number (w) and weekday (u) coherently?
I would like to set up a functionality for Google Sheets that provides a start and end day for a given week index number of the year. When using the Utilities.parseDate and Utilities.formatDate ...
0
votes
0
answers
120
views
Google Apps Script dateformat issue for ISO8601 timezone
I have to format date in a google Apps script but i have a mistake.
In the oracle documentation (link in the google Apps script help )[https://docs.oracle.com/javase/7/docs/api/java/text/...
0
votes
1
answer
350
views
Convert Date string into another string with different format
I'm quite new to the Java and for the use case I would like to know how to convert String "2023-02-01" into "02012023"
I had troubles understanding the correct usage of ...
-1
votes
1
answer
197
views
Why I am not able to parse 2013-03-10T02:59:59Z from PST in Java using parse method of java.text.SimpleDateFormat?
For certain input values though format and all things are correct, I am getting ParseException from SimpleDateFormat.parse(String input) method.
I'm in a scenario where I need to convert time from ...
0
votes
2
answers
831
views
Formatting timestamp to Date format [duplicate]
I have a question. I need to convert and display the data from database which it's a timestamp to date format only. *the format is dd/MM/yyyy
Currently I writng the code like this but the error says &...