Welcome, Guest
A place to meet other Developers

TOPIC: DateTime operations

DateTime operations 3 years 10 months ago #37951

I'm having trouble working with DateTime fields like PublishedDate and ReleasedDate. DateTime doesn't seem to be the same as datetime per the python documentation, but regardless

Basically, if the ReleasedDate is null, I want to set the ReleasedDate to be 2 months before the Year/Month. But I can't for the life of me figure out how to set the ReleasedDate field properly using str/int values, let alone other DateTime values. Can anyone provide an example?
The administrator has disabled public write access.

DateTime operations 3 years 10 months ago #37953

  • Stonepaw
  • Stonepaw's Avatar
  • Offline
  • Moderator
  • Posts: 921
  • Thank you received: 268
  • Karma: 173
The DateTime fields are .net System.DateTime

You can set ReleasedTime to a DateTime using Year/Month/Day integers with:
from System import DateTime
book.ReleasedTime = DateTime(year, month, day)

If you have a DateTime already and want to find two months before you can do:
from System import DateTime
book.ReleasedTime = date_time_value.AddMonths(-2)
The administrator has disabled public write access.

DateTime operations 1 year 1 month ago #46306

You can change the setting option and can set the time of your post before time or after time as per your choice.
The administrator has disabled public write access.
Time to create page: 0.161 seconds

Who's Online

We have 354 guests and 2 members online