date time issue

24 views
Skip to first unread message

ionutcri...@gmail.com

unread,
Dec 20, 2014, 2:24:29 AM12/20/14
to chica...@googlegroups.com
Hi guys! I'm trying to make an app that stores some appointments. For that I have 2 models patient and appointment. One patient has_many appointments and an appointment belongs_to a patient. The appointment has a date and a time and a duration. So far so got. But when I'm trying to save and appointment I get a wrong date and a time that has a {1970,4,15} extra tuple.
This is how I'm trying to populate the db:
 http://dpaste.com/3QGX2A9

but instead of getting a date like {2014,12,20} I get  {{2033,10,27},{4,26,52}} and time becomes  {{1970,4,15},{4,0,15}}.
When I'm doing programare:new(id, erlang:date(), erlang:time(), 15, "pacient-1"). I get what I expect: {programare,id,{2014,12,20},{9,22,56},15,"pacient-1"}, but after saving I get the weird stuff. Any ideas why and how to fix this? I'm using a mock db adapter should that matter.
Thank you!

can2nac

unread,
Dec 27, 2014, 3:40:41 PM12/27/14
to chica...@googlegroups.com, ionutcri...@gmail.com
link is broken.

u should try datetime() = {date(), time()}

and due to this u "get  {{2033,10,27},{4,26,52}} and time becomes  {{1970,4,15},{4,0,15}}."

can2nac

unread,
Dec 27, 2014, 3:41:38 PM12/27/14
to chica...@googlegroups.com, ionutcri...@gmail.com
{erlang:date(), erlang:time()}.
{{2014,12,20},{9,22,56}}

On Saturday, December 20, 2014 10:24:29 AM UTC+3, ionutcri...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages