345 questions
1
vote
0
answers
83
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 ...
2
votes
1
answer
61
views
26 March of 1995 could not be mapped into date using Europe/Sofia timezone [duplicate]
DateFomatter could not init the date from "1995-03-26" string when using "Europe/Sofia" timezone. I've also tried to use different timezones and everything works correctly, but not ...
0
votes
2
answers
154
views
iOS DateFormatter - Format Time in shortest way possible
I need a way to format a time in the shortest way possible.
Unforunately using a timeStyle of .short doesn't achieve what I want because times with zero minutes always unnecessarily show :00 in 12-...
1
vote
1
answer
51
views
What is the best way to use DateFormatters in UITableViews cellForRowAt method
I have a table view which has few cells. I need to display the date in a human-readable format whose raw format is retrieved from the API call. I am using the below code to call the convertToDate ...
-3
votes
1
answer
121
views
DateFormatter return different time in iOS 14.2 and iOS 16.4 [closed]
I tried to get the date and time from Timestamp. when I see it in iOS 16+ simulator it shows 04.46 PM whereas in iOS 14.2 it shows 16.47. Is there anything im doing wrong here?
Timestamp value: ...
-1
votes
1
answer
70
views
Convert a string date "ddMMyyyy" to random System Dormat Date vb.net
My scenario:
I have a random date in string formatted like "ddMMyyyy". (I know that is wrong to save data as string, please don't judge i get the data from a 3rd-party app). And i want to ...
0
votes
2
answers
592
views
How to Convert UTC time to PST time in react js
i am using react js and i am trying to convert UTC time to PST time but it is not converting according to online compilers.
Code:
const dateString = "12/18/2023, 8:00:00";
const utcDate = new Date(...
0
votes
4
answers
142
views
Get time from timestamp string that includes timezone
I receive a date
let slotDateString: String = "2023-12-06T15:45:00+04:00"
I have two formatters:
var iso8601FormatterWithFullTimeZone: DateFormatter {
let formatter = DateFormatter(...
0
votes
1
answer
447
views
Swift ISO8601DateFormatter not writing UTC offset when printing GMT date
I am trying to print a date and time, I would like the String representation to include the UTC offset.
This seems to work for date and times which are in the BST time zone, however when the date and ...
0
votes
0
answers
51
views
How to store date from Picker to Core Data?
I'd like to ask for an explanation why Dateformatter adds time and -1 day that I don't want. I need to save the date only in the format "yyyy-MM-dd" in the Date type field in Core Data
let ...
0
votes
1
answer
608
views
How do I localize a string that contains a date and the location of the text differs depending on the language?
I'm localizing my app for Hungarian users and having trouble figuring out how to handle a string with a date in it.
In English, I have a text string that should say "4 reps @ 120 kg on 8/19/23&...
-1
votes
3
answers
446
views
Converting 24hrs to 12hrs in Swift
I'm trying to convert 24 hours to 12 hours and when I run the code it does not convert to 12 hours. I'm not sure what I'm doing wrong.
Here's my code.
func getDate(date: Date) -> String {
let ...
0
votes
3
answers
143
views
Swift DateFormatter from String with (EEST)?
i am trying to parse string date which is coming from an API to Date().
the date string is: 31-07-2023 12:44 (EEST)
My code:
let formatter = DateFormatter()
formatter.dateFormat = "dd-MM-yyyy hh:...
-1
votes
2
answers
81
views
Swift DateFormatter returning tomorrow's date even after setting the Locale and Timezone
I'm using DateFormatter from Swift to show date to users in "yyyy.MM.dd" format. I find one thing very strange that even after I've set the Timezone, it gives me the date a day after.
let ...
0
votes
0
answers
42
views
why this date formatter not working correctly?
facing the following issue:
I'm try to create a date by adding 2 strings one with a date "23/06/2023" and one is the time "21:00"
why I'm getting this strange result:
see my ...
1
vote
1
answer
63
views
Check if date is 1 second away from new date
I want to check if the current date input is 1 second away from new date (Date format: "2023-05-20T23:59:59.000+05:30"). Below is my Date extension.
extension Date {
var isOneSecondAway: ...
0
votes
0
answers
143
views
Swift DateTimeFormatter TimeZone
I'm trying to convert a date-time string to a date, with a DateFormatter with the TimeZone set to UTC.
The input string is in the format yyyy-MM-dd'T'HH:mm:ss'Z'.
For some reason, the subsequent Date ...
-1
votes
1
answer
192
views
Using DateFormatter for shortening the date (UNIX timestamp)
I am trying to solve my issue with a Unix Timestamp. I figured out how to present it but the result is too long - it says:
"Friday March 31, 2023 at 11:13:52 PM Central European Summer Time"
...
0
votes
1
answer
121
views
formatting the x-axis label in plt.subplots
problem:
how to make the date display in a beautiful form, in the format "month-year"?
my code:
decompose_data = seasonal_decompose(df_res_indx, model='additive')
fig, axes = plt.subplots(...
1
vote
2
answers
102
views
Format date and time but exclude "today date" in Swift?
My code:
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .short
dateFormatter.dateStyle = .short
dateFormatter.locale = .current
lblDateTime.text = ...
0
votes
0
answers
341
views
Should I store a Birthday or other date that should not change with TimeZones in CoreData as Date or String
I have several dates that I want to store in CoreData. Those dates will always be fixed regardless of timezone and the time component is never needed. So that when the date is fetched and displayed ...
-1
votes
2
answers
97
views
Why Xcode & Simulator give me different dates?
I have this simple code (Xcode iOS app)
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Button(action: {
let dateToday = Date()
...
0
votes
1
answer
128
views
Convert Int to date formatter followed with timezone
Trying to convert Int to formatted string date with supplied timezone value and formatter to expected result "12/01/2022 09:03:41 PM THA".
//Response Data.
{
"code": "...
0
votes
0
answers
126
views
What happens in DateFormatter when Locale is initialized with an invalid identifier?
I noticed in our product that some legacy code is trying to initialize Locale for DateFormatter with invalid identifiers. (e.g. Locale(identifier: "UTC"))
Weirdly code is working fine for ...
1
vote
0
answers
133
views
Android DateTimeFormatter - Time Conversion not working on samsung devices
I was working on Time conversion from One Locale to another (US to Swedish) in android using Java. It is working well on all the devices except Samsung devices.
DateTimeFormatter parser = ...
0
votes
1
answer
915
views
difference for Locale.autoupdatingCurrent and fixed Locale behavior
If I use system locale (Locale.autoupdatingCurrent) then DateFormatter uses 24 switch in system settings.
let locale = Locale.autoupdatingCurrent;
let timeZone = TimeZone(secondsFromGMT: 0*3600)!
var ...
0
votes
0
answers
419
views
iOS: 24 hour time formatting not honored with Region=Canada, Language=French
If Language is French and Region is Canada, the Languge & Region pane in Settings shows 24 hour time formatting in the sample area as expected, as does the rest of iOS and stock apps.
But if I ...
-2
votes
1
answer
84
views
Date formatting in Swift
I have time values in JSON like so:
"start_date": "2018-04-20 9:00:00 -08:00",
"end_date": "2018-4-20 12:00:00 -08:00"
I want to ...
0
votes
1
answer
71
views
How can I order hours(am/pm) array
Firstly I have to say this.
ÖÖ: AM
ÖS: PM
I have hours array like that:
[["12:15 ÖS", "02:00 ÖS"],["09:00 ÖÖ", "10:00 ÖÖ"],["10:30 ÖÖ", "12:00 ...
1
vote
1
answer
777
views
iOS: Date formatter with "ar_AE" language code not converting date to Arabic
When I try to convert date to Arabic language with below code & ar_AE language code, it shows date in western numerals not in Arabic.
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = ...
0
votes
1
answer
546
views
how to set title formatter in prolificinteractive material-calendarview in kotlin
i'm using this method to set my title format but when i click on next arrow button month and year not change, sep,2022 not change
<com.prolificinteractive.materialcalendarview....
1
vote
1
answer
381
views
iOS 15.4 Date Format "Sep" now "Sept"
The app crashes once the user selects any date of September.
It only happens with iOS 15.4.
I have datePicker formatted date to return always in UTC format en_GB.
@objc func doneDateClicked() {
...
-1
votes
1
answer
1k
views
DateFormatter date decoding error in Swift from JSON data [duplicate]
This is the error I get
Invalid data: typeMismatch(Swift.Double, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "Services", intValue: nil), _JSONKey(stringValue: "...
0
votes
0
answers
29
views
Swift String to Date conversion returning wrong time [duplicate]
I need to convert a string date in the following format and while the date is returning correctly the time is not. The string being sent is "2022-08-16 02:07:11 America/Los_Angeles" however ...
0
votes
2
answers
949
views
How to make the st,nd,rd,th as superscript along with date and time in swift ios
How to make the st,nd,rd,th as supescript along with date and time in swift xcode 13.
I have set the items in the tableviewcell
From the tableView cell I'm setting the date and time like in below code
...
-1
votes
1
answer
585
views
Swift String to date conversion found nil while unwrapping an Optional value
I'm receiving a PST date inside a string in the following format "2022-08-14 13:45:39 America/Los_Angeles" and I'm trying to convert it to a real date using the code below which is causing ...
0
votes
0
answers
569
views
DateFormatter and ISO8601DateFormatter - various time zones in result [duplicate]
I have Swift 5 and such date string:
let dateString = "2019-11-09T08:14:09.361404Z"
and two approaches to convert it to date:
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = &...
3
votes
2
answers
210
views
Accept Arabic date as query parameter in Spring Boot
I want to accept Arabic date in the query parameter
ex:
٢٠٢١-٠٧-٢٠ the English version of this date is 2021-07-20
I have found this soltion
DecimalStyle defaultDecimalStyle
= DateTimeFormatter....
0
votes
1
answer
71
views
DateFormater gives day before swift
when I use DateFormateer it returns me a day before.
nextDayShouldBe = currectDay.addingTimeInterval(24 * 3600)
print(nextDayShouldBe) //prints (2022-07-02 21:58:11 +0000) it's right
let ...
-1
votes
3
answers
142
views
DateFormatter showing incorrect time
My requirement is to convert date string (in PHT) received from my API to another date string format.
API Date String format: "MM/dd/yyyy HH:mma" eg. "06/28/2022 06:55PM"
UI Date ...
0
votes
1
answer
2k
views
Java - format Date only with slash based on locale
My code is
ZonedDateTime zoned = ZonedDateTime.now();
DateTimeFormatter pattern = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).withLocale(Locale.forLanguageTag("ja-JP"));
System.out....
1
vote
1
answer
2k
views
How to validate dates with time zone?
I want to use the following ISO 8601 Format(Date and time with timezone) :
yyyy-MM-ddTHH:mm:ss.SSSZ
To verify if the string date is valid or not.
I have as input a String date
String dateRight = "...
0
votes
1
answer
66
views
swift problem on calculate time difference
I have develop a function that calculate the time difference between two date giving the two date as string here below the function
func calculateTimeDifference(startDate: String, endDate: String) -&...
-1
votes
1
answer
2k
views
How to retrieve time in hh:mm:ss format from Time stamp in Java
I have an issue related to retrieving time from time stamp. Below is the code, I get the timestamp from gui, which I need to convert into hh:mm:ss and insert into database.
LocalDate timestamp = ...
0
votes
2
answers
249
views
How to return a date using dateformatter in Swift?
I have a little problem and I don't know how can I solve it. I have a closedRange of dates which i'm using with a DatePicker.
How can I have a date with that format that I have in the code bellow ?
...
0
votes
0
answers
298
views
Building a simple to-do list app with SwiftUI - date formatting
I’m playing about with SwiftUI for the first time with a simple to do style app. It has 2 views, one a list view, and the other an Add To Do view, which saves info into core data. In core data I have ...
10
votes
0
answers
5k
views
Date format "dd-MMM-yyyy" for September now Sept. Not Sep so converting causes nil
Updated iPad to iOS 15.4.
Now String to Date conversion using DateFormatter returns nil when stored month format "MMM" = Sep.
Works ok when MMM Month = Sept.
Did work in iOS 15.3 and earlier....
1
vote
1
answer
2k
views
How to change date format from dd MMMM YYYY in swift?
I need date to be convert from dd MMMM YYYY to dd-mm-yyyy.
e.g. : (01 August 2021) -> 01-09-2021
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_US_POSIX"...
2
votes
1
answer
420
views
Properly ordering month and date according to locale
I want to display start and end date of week in a human readable format. Using MMMM d as date format base. For example:
- March 7 - 13
- February 28 - March 6
- 7-13 de marzo
So if week start and end ...
0
votes
1
answer
172
views
Swift DateFormatter - Parse from UTC String
I'm using a String extension to parse utc string to Date. But the parsed date is wrong. Not sure what i'm missing.
extension String {
var parseUTCDateTime:Date? {
let parser = DateFormatter()
...