Parsing time to string results in date
See original GitHub issueI’m trying to parse an excel sheet where one of the columns is time viz. 5:15PM
, 7:10AM
. I can store these values successfully as strings just by doing myTimeVar.toString()
.
However, when the time value has a space in between e.g. 5:15 PM
and 7:10 AM
, the toString()
method returns a full blown date object as string. For instance, myTimeVar.toString()
prints Sat Dec 30 1899 16:15:00 GMT-0500 (Eastern Standard Time)
where myTimeVar is 5:15 PM
(with a space in between time and PM).
I even tried avoiding toString()
and using String()
but no success.
More details here.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Date.parse() - JavaScript - MDN Web Docs
The parse() method takes a date string (such as "2011-10-10T14:48:00" ) and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC....
Read more >Formatting and parsing dateTimes as strings - IBM
This section gives information on how you can specify the dateTime format using a string of pattern letters.
Read more >javascript - Parsing time to string results in date - Stack Overflow
I'm trying to parse an excel sheet where one of the columns is time viz. 5:15PM , 7:10AM . I can store these...
Read more >DateTime.Parse Method (System) - Microsoft Learn
The Parse method tries to convert the string representation of a date and time value to its DateTime equivalent. It tries to parse...
Read more >Parsing: date-time - clock
date_time_parse() is useful for strings like "2019-01-01 00:00:00" , where the UTC offset and full time zone name are not present in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, excel has this kinda of weird behavior. Try to copy all the values of this column to the Notepad (or other text editor), select the entire column and change its type to Text, then paste back the values from Notepad. After that, hopefully you will have all the original data as text.
Anybody found solution for convert date fields to string fields?
Currently I’m try solve it. If can i find way I’ll share it with you.