Skip to main content

All Questions

0 votes
1 answer
62 views

How do I drop empty strings from a data frame while converting to datetime?

I am using Juypter notebooks to look at some stock data. That being said, I have come across a weird error which I don't totally understand. time_and_sales['Trade_time'] = time_and_sales['Trade_time']....
user avatar
0 votes
2 answers
241 views

Is there a format string for SimpleDateFormat to get milliseconds date-time value instead of human-readable form?

By means of classes like SimpleDateFormat it is possible to format time and date in a suitable format. Examples here https://developer.android.com/reference/java/text/SimpleDateFormat#examples In ...
P5music's user avatar
  • 3,337
2 votes
2 answers
4k views

formatting date, time and string for filename

I want to create a csv file with a filename of the following format: "day-month-year hour:minute-malware_scan.csv" Example:" 6-8-2016 21:45-malware_scan.csv" The first part of the filename is ...
Fabio's user avatar
  • 2,112
0 votes
2 answers
76 views

Python String formatting for datetime

I am trying to solve a problem: In the library code I have something like: return format % (value.year, value.month, value.day, value.hour, value.minute,value.second, value....
Meaner's user avatar
  • 1
-4 votes
2 answers
1k views

DateTime? to string yyyy-mm-dd [duplicate]

I have a method that takes a parameter of the type DateTime? I need to convert what I receive to a string of the format - yyyy-mm-dd What is the cleanest optimal way to achieve this?
GilliVilla's user avatar
  • 5,090
1 vote
2 answers
127 views

Given input dates as strings find Age in Days

I have a procedure that calculates age in days. I am thinking of using it to help me calculate my pay days. I want it to ask for date 1 and then date 2, which would also be the current date. However,...
Clever Programmer's user avatar
0 votes
1 answer
11k views

Formatting datetime in python

print str(now.month) + str(now.day) + str(now.year) Result: 1162014 How do I further format the result to add slashes: 11/6/2014 Also how would I do formatting for hour, minute, and second? hh:mm:ss ...
Xilas's user avatar
  • 17
0 votes
2 answers
125 views

Datetime formatting in python

Should be simple enough. I have a datetime object in python, I need it to be of the form 20131002 Is there a way to format this without having to resort to breaking the date into it's components and ...
Zack's user avatar
  • 14k
1 vote
1 answer
535 views

Format a string that is a date to display D/M/Y

Currently I have a date in my clients data table and it is stored as a varchar. Im am using MVC3 with Razorviews. how can I format this date when it is by default a string to render as D/M/Y? ...
EB.'s user avatar
  • 2,757
5 votes
1 answer
8k views

NumberFormat parsing currency value failure

Why is the following generating parse exceptions when parsing using the Currency instances of Number format. float f1 = 123.45678f; Locale locFR = new Locale("fr"); ...
ziggy's user avatar
  • 15.9k
3 votes
2 answers
5k views

Trying to convert string to datetime in a different format than the string

So I had to convert a date in the format of (MM-dd-yyyy) to (dd-MMM-yyyy). What I ended up doing was this... string strProvisionalDate = "04-22-2001"; string strFormat = "MM-dd-yyyy"; DateTime ...
OneFreeFitz's user avatar
1 vote
1 answer
2k views

How do I change the format of a date/time string in perl? (specific question)

I have an example string parsed from a log file in the following format: "Mon Apr 25 17:47:19 2011" and I want it to look like "Mon Apr 25 05:47PM 2011" How would I do this in general? (i.e. it's ...
john's user avatar
  • 13
4 votes
5 answers
19k views

Convert DateTime to string with format YYYYMMDD

I have birth dates stored as datetime in SQL Server 2008 like so: 2010-04-25 00:00:00.000 What is the best way, using C#, to convert and format this into a string with a YYYYMMDD format? In the end, ...
Sesame's user avatar
  • 3,410
8 votes
1 answer
11k views

Convert Unix Timestamp to human format in Django with Python

I'd like to a convert unix timestamp I have in a string (ex. 1277722499.82) into a more humanized format (hh:mm:ss or similar). Is there an easy way to do this in python for a django app? This is ...
Anon's user avatar
  • 5,173
16 votes
1 answer
60k views

Why doesn't code like `"A %s", "B" % "C"` interpolate "C" into the first string?

Im wrtiting a script which saves the current date and time as a filename but I get an error stating "TypeError: not all arguments converted during string formatting" I am new to Python andmay of ...
Craig's user avatar
  • 223

15 30 50 per page