Tag datetime-format

[Solved] How to get date and time in below format in java? [closed]

Your answer should look something like this: String dateTimePattern = “dd-MM-yyyy HH:mm a”; DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateTimePattern ); LocalDateTime yourDay= LocalDateTime.of(2020, 4, 6, 17, 00); System.out.println(formatter.format(ZonedDateTime.of(yourDay, ZoneId.of(“UTC-5”)))); Please look this up for more info on the available formats. 7 solved…

[Solved] Getting specific datetime format in C#

Something like this? string output = DateTime.Now.ToString(“yyyy-0MM-ddTHH:mm:ss:fffZ”); I’m not sure about the “Z”, if you wanted some time zone info. I zero padded the month like your example. Obviously there would never be a needed third decimal place. 1 solved…

[Solved] Convert time format to UTC format [closed]

Try This. NSString *strIncomingDate = @”29-Mar-2018 05:58:33″; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@”UTC”]]; [dateFormat setDateFormat:@”dd-MMM-yyyy hh:mm:ss”]; NSDate *date = [dateFormat dateFromString:strIncomingDate]; NSDateFormatter *dateFormat1 = [[NSDateFormatter alloc] init]; [dateFormat1 setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@”UTC”]]; [dateFormat1 setDateFormat:@”yyyy-MM-dd’T’HH:mm:ss’Z'”]; NSString *strDesire = [dateFormat1 stringFromDate:date];…

[Solved] How to subtract time with current time

The time difference (in milliseconds) can be obtained using: ChronoUnit.MILLIS .between(Instant.parse(“2018-07-26T16:00:17.163Z”), Instant.now()) Instant.now() will be the current UTC time, and your input date is UTC time, which makes the diff sensible. Regardless of the current time zone, the difference will…