For pretty much everything AWS calculates an hourly cost, and charges you based on that. Your second estimate is the correct one - as in both quantity and time (in hours) are factored into the cost - essentially, cost based on the weighted average of usage over the month.
AWS provides a value called 'EBS:VolumeUsage', which is in byte-hours. So, for instance, you may see, for a one hour period, 11811160064 byte-hours. Dividing by 1024^3 (to convert to GB-hours) will give me the number of GB allocated during that hour (in this case, 11GB).
The total byte-hours consumed in the month are summed up, and you are charged accordingly. So, for your 30GiB for 1 day example. In each 1 hour period, you consume '30*1024^3 byte-hours' (32212254720 or 30GiB-hours). Over the 24 hour period, you consume 773094113280 byte-hours (or 720GiB-hours). Presuming no additional EBS usage over the course of the month, this figure can be divided by the number of byte-hours 1GiB would consume over the month (let's say 730h/mo) to get the final cost:
1GB = 1024^3*730 = 783831531520 byte-hours (or 730GiB-hours). You have therefore consumed 0.986 GiB-month of EBS:VolumeUsage, and your bill is $0.10. (It is rather convoluted to use byte-hours, but it uses the values that AWS quotes on their usage reports. Since the smallest possible increment on an EBS volume is 1GiB, GiB-hours should offer the same accuracy, with more reasonable numbers).
Just to complete the idea with a second example, consider the following:
Allocate 30GB for 24 hours, 10GB for 5 hours, and 5GB for 730 hours
The cost for the above works out as follows:
Usage: (30GB-h*24+10GB-h*5+5GB-h*730)/730h/mo = 6.05GB-mo
Cost: $0.10/GB-mo * 6.05GB-mo = $0.61