Questions tagged [datetime-parsing]

423 questions
0
votes
2 answers

Format a DateTime using a Microsoft Word date picker content control format string

Microsoft Word's date picker content control (which you can add to a document through the hidden-by-default Developer ribbon) uses date/time formatting strings that are slightly incompatible with DateTime.ToString. For example: If I use the same…
Joey Adams
  • 41,996
  • 18
  • 86
  • 115
0
votes
1 answer

CDate on windows XP

In the form I use DateTimePicker like this: With dtp_myDate .Format = DateTimePickerFormat.Custom .CustomFormat = "dd.MM.yyyy." .Value = CType("16.12.2013. 11:30:25.1234", Date) End With Also I may use CDate instead of CType where in…
Wine Too
  • 4,515
  • 22
  • 83
  • 137
0
votes
3 answers

Not getting the expected output in formatting the date

I want my program to validate that the date format is mm/dd/yyyy. I don't want to use any throw/catch blocks. class FunWithScheduling { public void AddView() { ... ... Console.WriteLine("Enter the Date Scheduled For…
Ruckus Maker
  • 25
  • 1
  • 6
0
votes
2 answers

Parsing of string into DateTime always gets 00:00 for time part that is formatted like HH\mm

I'm parsing dates and times from an XML using this function: DateTime.ParseExact(timeEndString, "yyyyMMddHHmm", CultureInfo.InvariantCulture); Everything is working fine unless the time is 00:00. In thins case I'm getting only date without time. Is…
Nelrum
  • 113
  • 2
  • 9
0
votes
2 answers

always getting string was not recognized as valid datetime. how to convert for current format

I want to accept date in dd-MM-yyyy format using textbox I have used ajax calendar also. DateTime.ParseExact(txtDate.Text,"dd-MM-yyyy",null) and Convert.ToDateTime(txtDate.Text) are both throwing exception: string was not recognized as valid…
donstack
  • 2,557
  • 3
  • 29
  • 44
0
votes
7 answers

Combine Date and Time

I need to combine date and time and insert into one datetime row. Here is my code: DateTime Headlinedate; try { DateTime date = Convert.ToDateTime(txtHeadlinedate.Text.Trim(), Ci); string timestr = DateTime.Now.ToString("hh:mm:ss…
Mandragorasprout
  • 123
  • 1
  • 6
  • 12
0
votes
1 answer

DateTime format - what am I doing wrong?

I have this string: "14. januar 2013 9:15:00 EST". From what I understand the format is the following: d. MMMM yyyy H:mm:ss EST, but I've tried the following code, and nothing works. What am I doing wrong here? private static string[]…
0
votes
1 answer

String not recognized as valid datetime

My code gives the above error. I have tried to change it based on the link below: String was not recognized as a valid DateTime “ format dd/MM/yyyy” but it still does not work. Would be grateful if somebody can point me in the right direction. My…
user1270384
  • 711
  • 7
  • 24
  • 53
-1
votes
3 answers

How to convert Timestamp in CDT Format to MM/DD in Java?

I have a timestamp in cdt format as below "2023-06-05T09:00:01CDT", I want to convert this timestamp into MM/DD format in Java. I have tried below : The expected output was: 6/5 But was getting parsing error. ZonedDateTime ztime =…
-1
votes
1 answer

Unable to obtain LocalDateTime from TemporalAccessor: when trying to sort the date in the stream

I want to sort the posts by date("hh:mm:ss"). but I get a mistake. Can you tell me what I did wrong? java.time.format.DateTimeParseException: Text '12:55:36' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {HourOfAmPm=0,…
R Zav
  • 29
  • 4
-1
votes
1 answer

Get period between two times

I have two string time. How can I get a duration of period between theese two time? I try to use DateTimeFormatter, but it doesn't work. val startTime = LocalDate.parse("19:30", DateTimeFormatter.ofPattern("HH:mm")) val endTime =…
Jekis Osipov
  • 133
  • 10
-1
votes
1 answer

String timestamp to Date in java

I want to convert a String timestamp "20221225182600Z+0100" to date in java without using simpledateformat I am getting an error Text '20221225182600Z+0100' could not be parsed at index 2 String dateString =…
-1
votes
1 answer

Time Conversion in java from SGT to UTC not working for 12:35:42

Trying to convert Singapore Time to UTc and need the result in OffsetDateTime. The below code works for me for all scenerios except one for 12:35..... for 12:00 noon it is somehow giving wrong results. Should be giving 8th Feb 04:35 morning but…
-1
votes
1 answer

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 PST timezone to local timezone; it works almost all…
-1
votes
1 answer

Java: How to convert "Mon Jun 18 11:32:05 BST 2012" to 18 June 2012

I have a value like the following Mon Jun 18 11:32:05 BST 2012 and I want to convert this to 18 June 2012 How to convert this? Below is what i have tried.. public String getRequiredDate(String sendInputDate) { Optional date =…
Ravi
  • 25
  • 6